idnits 2.17.1 draft-ietf-p2psip-base-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** The document seems to lack a License Notice according IETF Trust Provisions of 28 Dec 2009, Section 6.b.i or Provisions of 12 Sep 2009 Section 6.b -- however, there's a paragraph with a matching beginning. Boilerplate error? (You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Feb 2009 rather than one of the newer Notices. See https://trustee.ietf.org/license-info/.) 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 : ---------------------------------------------------------------------------- ** There are 3 instances of too long lines in the document, the longest one being 2 characters in excess of 72. -- 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 1768 has weird spacing: '...Options optio...' == Line 2191 has weird spacing: '...te_type typ...' == Line 2249 has weird spacing: '...tyValue ide...' == Line 2504 has weird spacing: '...ionType typ...' == Line 3689 has weird spacing: '...naryKey key...' == (1 more instance...) -- 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 (March 07, 2009) is 5529 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '16' on line 1671 == Missing Reference: 'RFC2988' is mentioned on line 3123, but not defined ** Obsolete undefined reference: RFC 2988 (Obsoleted by RFC 6298) == Missing Reference: 'REF' is mentioned on line 5696, but not defined == Unused Reference: 'I-D.zheng-p2psip-diagnose' is defined on line 5881, but no explicit reference was found in the text ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) == Outdated reference: A later version (-16) exists of draft-ietf-behave-turn-12 == Outdated reference: A later version (-16) exists of draft-ietf-mmusic-ice-tcp-07 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) == Outdated reference: A later version (-09) exists of draft-ietf-p2psip-concepts-02 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 3280 (Obsoleted by RFC 5280) == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-00 Summary: 6 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: September 8, 2009 unaffiliated 6 E. Rescorla 7 Network Resonance 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 March 07, 2009 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-02 16 Status of this Memo 18 This Internet-Draft is submitted to IETF in full conformance with the 19 provisions of BCP 78 and BCP 79. This document may contain material 20 from IETF Documents or IETF Contributions published or made publicly 21 available before November 10, 2008. The person(s) controlling the 22 copyright in some of this material may not have granted the IETF 23 Trust the right to allow modifications of such material outside the 24 IETF Standards Process. Without obtaining an adequate license from 25 the person(s) controlling the copyright in such materials, this 26 document may not be modified outside the IETF Standards Process, and 27 derivative works of it may not be created outside the IETF Standards 28 Process, except to format it for publication as an RFC or to 29 translate it into languages other than English. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF), its areas, and its working groups. Note that 33 other groups may also distribute working documents as Internet- 34 Drafts. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 The list of current Internet-Drafts can be accessed at 42 http://www.ietf.org/ietf/1id-abstracts.txt. 44 The list of Internet-Draft Shadow Directories can be accessed at 45 http://www.ietf.org/shadow.html. 47 This Internet-Draft will expire on September 8, 2009. 49 Copyright Notice 51 Copyright (c) 2009 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 in effect on the date of 56 publication of this document (http://trustee.ietf.org/license-info). 57 Please review these documents carefully, as they describe your rights 58 and restrictions with respect to this document. 60 Abstract 62 In this document the term BCP 78 and BCP 79 refer to RFC 3978 and RFC 63 3979 respectively. They refer only to those RFCs and not any 64 documents that update or supersede them. 66 This document defines REsource LOcation And Discovery (RELOAD), a 67 peer-to-peer (P2P) signaling protocol for use on the Internet. A P2P 68 signaling protocol provides its clients with an abstract storage and 69 messaging service between a set of cooperating peers that form the 70 overlay network. RELOAD is designed to support a P2P Session 71 Initiation Protocol (P2PSIP) network, but can be utilized by other 72 applications with similar requirements by defining new usages that 73 specify the kinds of data that must be stored for a particular 74 application. RELOAD defines a security model based on a certificate 75 enrollment service that provides unique identities. NAT traversal is 76 a fundamental service of the protocol. RELOAD also allows access 77 from "client" nodes that do not need to route traffic or store data 78 for others. 80 Legal 82 This documents and the information contained therein are provided on 83 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 84 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 85 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 86 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 87 WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE 88 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 89 FOR A PARTICULAR PURPOSE. 91 Table of Contents 93 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 94 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 95 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 96 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 97 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 98 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 14 99 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 100 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 101 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 16 102 1.4. Structure of This Document . . . . . . . . . . . . . . . 17 103 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 104 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 19 105 3.1. Security and Identification . . . . . . . . . . . . . . 19 106 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 20 107 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 21 108 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 21 109 3.2.2. Minimum Functionality Requirements for Clients . . . 22 110 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 22 111 3.4. Connectivity Management . . . . . . . . . . . . . . . . 25 112 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 26 113 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 26 114 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 26 115 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 28 116 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 28 117 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 28 118 4. Application Support Overview . . . . . . . . . . . . . . . . 28 119 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 29 120 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 30 121 4.1.2. Usages . . . . . . . . . . . . . . . . . . . . . . . 31 122 4.1.3. Replication . . . . . . . . . . . . . . . . . . . . 31 123 4.2. Service Discovery . . . . . . . . . . . . . . . . . . . 32 124 4.3. Application Connectivity . . . . . . . . . . . . . . . . 32 125 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 32 126 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 33 127 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 33 128 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 34 129 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 35 130 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 35 131 5.2.1. Request Origination . . . . . . . . . . . . . . . . 35 132 5.2.2. Response Origination . . . . . . . . . . . . . . . . 36 133 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 36 134 5.3.1. Presentation Language . . . . . . . . . . . . . . . 37 135 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 38 136 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 40 137 5.3.2.1. Processing Configuration Sequence Numbers . . . . 42 138 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 43 139 5.3.2.3. Route Logging . . . . . . . . . . . . . . . . . . 44 140 5.3.2.4. Forwarding Options . . . . . . . . . . . . . . . 46 141 5.3.3. Message Contents Format . . . . . . . . . . . . . . 47 142 5.3.3.1. Response Codes and Response Errors . . . . . . . 48 143 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 50 144 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 53 145 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 53 146 5.4.2. Methods and types for use by topology plugins . . . 53 147 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 53 148 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 54 149 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 54 150 5.4.2.4. Route_Query . . . . . . . . . . . . . . . . . . . 55 151 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 56 152 5.5. Forwarding and Link Management Layer . . . . . . . . . . 58 153 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 58 154 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 59 155 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 60 156 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 60 157 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 60 158 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 61 159 5.5.1.6. Encoding the Attach Message . . . . . . . . . . . 61 160 5.5.1.7. Verifying ICE Support . . . . . . . . . . . . . . 62 161 5.5.1.8. Role Determination . . . . . . . . . . . . . . . 62 162 5.5.1.9. Connectivity Checks . . . . . . . . . . . . . . . 62 163 5.5.1.10. Concluding ICE . . . . . . . . . . . . . . . . . 62 164 5.5.1.11. Subsequent Offers and Answers . . . . . . . . . . 63 165 5.5.1.12. Media Keepalives . . . . . . . . . . . . . . . . 63 166 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 63 167 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 63 168 5.5.2. AttachLite . . . . . . . . . . . . . . . . . . . . . 64 169 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 64 170 5.5.2.2. Attach-Lite Connectivity Checks . . . . . . . . . 65 171 5.5.2.3. Implementation Notes for Attach-Lite . . . . . . 65 172 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 65 173 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 66 174 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 66 175 5.5.4. Config_Update . . . . . . . . . . . . . . . . . . . 66 176 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 66 177 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 67 178 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 67 179 5.6.1. Future Support for HIP . . . . . . . . . . . . . . . 68 180 5.6.2. Reliability for Unreliable Links . . . . . . . . . . 68 181 5.6.2.1. Framed Message Format . . . . . . . . . . . . . . 68 182 5.6.2.2. Retransmission and Flow Control . . . . . . . . . 70 183 5.6.3. Fragmentation and Reassembly . . . . . . . . . . . . 71 184 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 72 185 6.1. Data Signature Computation . . . . . . . . . . . . . . . 73 186 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 74 187 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 74 188 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 75 189 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 75 190 6.3. Access Control Policies . . . . . . . . . . . . . . . . 76 191 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 76 192 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 76 193 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 76 194 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 77 195 6.3.5. USER-MATCH-WITH-ANONYMOUS-CREATE . . . . . . . . . . 77 196 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 77 197 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 77 198 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 77 199 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 81 200 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 82 201 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 83 202 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 83 203 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 85 204 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 86 205 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 86 206 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 86 207 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 88 208 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 88 209 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 89 210 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 90 211 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 90 212 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 91 213 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 92 214 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 93 215 9.2. Reactive vs Periodic Recovery . . . . . . . . . . . . . 93 216 9.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 94 217 9.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 94 218 9.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 95 219 9.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 95 220 9.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 96 221 9.7.1. Sending Updates . . . . . . . . . . . . . . . . . . 97 222 9.7.2. Receiving Updates . . . . . . . . . . . . . . . . . 98 223 9.7.3. Stabilization . . . . . . . . . . . . . . . . . . . 99 224 9.8. Route Query . . . . . . . . . . . . . . . . . . . . . . 100 225 9.9. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 101 226 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 101 227 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 101 228 10.1.1. Relax NG Grammars . . . . . . . . . . . . . . . . . 104 229 10.2. Discovery Through Enrollment Server . . . . . . . . . . 106 230 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 107 231 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 108 232 10.4. Joining the Overlay Peer . . . . . . . . . . . . . . . . 108 233 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 109 234 12. Security Considerations . . . . . . . . . . . . . . . . . . . 115 235 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 115 236 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 116 237 12.3. Certificate-based Security . . . . . . . . . . . . . . . 116 238 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 117 239 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 117 240 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 118 241 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 118 242 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 119 243 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 119 244 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 120 245 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 120 246 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 120 247 12.6.3. Peer Identification and Authentication . . . . . . . 121 248 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 121 249 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 122 250 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 122 251 13.1. Port Registrations . . . . . . . . . . . . . . . . . . . 122 252 13.2. Overlay Algorithm Types . . . . . . . . . . . . . . . . 123 253 13.3. Access Control Policies . . . . . . . . . . . . . . . . 123 254 13.4. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 123 255 13.5. Data Model . . . . . . . . . . . . . . . . . . . . . . . 124 256 13.6. Message Codes . . . . . . . . . . . . . . . . . . . . . 124 257 13.7. Error Codes . . . . . . . . . . . . . . . . . . . . . . 125 258 13.8. Route Log Extension Types . . . . . . . . . . . . . . . 126 259 13.9. Overlay Link Types . . . . . . . . . . . . . . . . . . . 126 260 13.10. Forwarding Options . . . . . . . . . . . . . . . . . . . 127 261 13.11. Probe Information Types . . . . . . . . . . . . . . . . 127 262 13.12. reload: URI Scheme . . . . . . . . . . . . . . . . . . . 127 263 13.12.1. URI Registration . . . . . . . . . . . . . . . . . . 128 264 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 128 265 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 129 266 15.1. Normative References . . . . . . . . . . . . . . . . . . 129 267 15.2. Informative References . . . . . . . . . . . . . . . . . 130 268 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 133 269 A.1. Changes since draft-ietf-p2psip-reload-01 . . . . . . . 133 270 A.2. Changes since draft-ietf-p2psip-reload-00 . . . . . . . 133 271 A.3. Changes since draft-ietf-p2psip-base-00 . . . . . . . . 133 272 A.4. Changes since draft-ietf-p2psip-base-01 . . . . . . . . 133 273 A.5. Changes since draft-ietf-p2psip-base-01a . . . . . . . . 133 274 Appendix B. Routing Alternatives . . . . . . . . . . . . . . . . 134 275 B.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 134 276 B.2. Symmetric vs Forward response . . . . . . . . . . . . . 134 277 B.3. Direct Response . . . . . . . . . . . . . . . . . . . . 135 278 B.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 136 279 B.5. Symmetric Route Stability . . . . . . . . . . . . . . . 136 280 Appendix C. Why Clients? . . . . . . . . . . . . . . . . . . . . 137 281 C.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 137 282 C.2. Clients as Application-Level Agents . . . . . . . . . . 138 284 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 138 286 1. Introduction 288 This document defines REsource LOcation And Discovery (RELOAD), a 289 peer-to-peer (P2P) signaling protocol for use on the Internet. It 290 provides a generic, self-organizing overlay network service, allowing 291 nodes to efficiently route messages to other nodes and to efficiently 292 store and retrieve data in the overlay. RELOAD provides several 293 features that are critical for a successful P2P protocol for the 294 Internet: 296 Security Framework: A P2P network will often be established among a 297 set of peers that do not trust each other. RELOAD leverages a 298 central enrollment server to provide credentials for each peer 299 which can then be used to authenticate each operation. This 300 greatly reduces the possible attack surface. 302 Usage Model: RELOAD is designed to support a variety of 303 applications, including P2P multimedia communications with the 304 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 305 the definition of new application usages, each of which can define 306 its own data types, along with the rules for their use. This 307 allows RELOAD to be used with new applications through a simple 308 documentation process that supplies the details for each 309 application. 311 NAT Traversal: RELOAD is designed to function in environments where 312 many if not most of the nodes are behind NATs or firewalls. 313 Operations for NAT traversal are part of the base design, 314 including using ICE to establish new RELOAD or application 315 protocol connections. 317 High Performance Routing: The very nature of overlay algorithms 318 introduces a requirement that peers participating in the P2P 319 network route requests on behalf of other peers in the network. 320 This introduces a load on those other peers, in the form of 321 bandwidth and processing power. RELOAD has been defined with a 322 simple, lightweight forwarding header, thus minimizing the amount 323 of effort required by intermediate peers. 325 Pluggable Overlay Algorithms: RELOAD has been designed with an 326 abstract interface to the overlay layer to simplify implementing a 327 variety of structured (DHT) and unstructured overlay algorithms. 328 This specification also defines how RELOAD is used with Chord, 329 which is mandatory to implement. Specifying a default "must 330 implement" overlay algorithm will allow interoperability, while 331 the extensibility allows selection of overlay algorithms optimized 332 for a particular application. 334 These properties were designed specifically to meet the requirements 335 for a P2P protocol to support SIP. This document defines the base 336 protocol for the distributed storage and location service, as well as 337 critical usages for NAT traversal and security. The SIP Usage itself 338 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 339 limited to usage by SIP and could serve as a tool for supporting 340 other P2P applications with similar needs. RELOAD is also based on 341 the concepts introduced in [I-D.ietf-p2psip-concepts]. 343 1.1. Basic Setting 345 In this section, we provide a brief overview of the operational 346 setting for RELOAD. See the concepts document for more details. A 347 RELOAD Overlay Instance consists of a set of nodes arranged in a 348 partly connected graph. Each node in the overlay is assigned a 349 numeric Node-ID which, together with the specific overlay algorithm 350 in use, determines its position in the graph and the set of nodes it 351 connects to. The figure below shows a trivial example which isn't 352 drawn from any particular overlay algorithm, but was chosen for 353 convenience of representation. 355 +--------+ +--------+ +--------+ 356 | Node 10|--------------| Node 20|--------------| Node 30| 357 +--------+ +--------+ +--------+ 358 | | | 359 | | | 360 +--------+ +--------+ +--------+ 361 | Node 40|--------------| Node 50|--------------| Node 60| 362 +--------+ +--------+ +--------+ 363 | | | 364 | | | 365 +--------+ +--------+ +--------+ 366 | Node 70|--------------| Node 80|--------------| Node 90| 367 +--------+ +--------+ +--------+ 368 | 369 | 370 +--------+ 371 | Node 85| 372 |(Client)| 373 +--------+ 375 Because the graph is not fully connected, when a node wants to send a 376 message to another node, it may need to route it through the network. 377 For instance, Node 10 can talk directly to nodes 20 and 40, but not 378 to Node 70. In order to send a message to Node 70, it would first 379 send it to Node 40 with instructions to pass it along to Node 70. 380 Different overlay algorithms will have different connectivity graphs, 381 but the general idea behind all of them is to allow any node in the 382 graph to efficiently reach every other node within a small number of 383 hops. 385 The RELOAD network is not only a messaging network. It is also a 386 storage network. Records are stored under numeric addresses which 387 occupy the same space as node identifiers. Nodes are responsible for 388 storing the data associated with some set of addresses as determined 389 by their Node-ID. For instance, we might say that every node is 390 responsible for storing any data value which has an address less than 391 or equal to its own Node-ID, but greater than the next lowest 392 Node-ID. Thus, Node-20 would be responsible for storing values 393 11-20. 395 RELOAD also supports clients. These are nodes which have Node-IDs 396 but do not participate in routing or storage. For instance, in the 397 figure above Node 85 is a client. It can route to the rest of the 398 RELOAD network via Node 80, but no other node will route through it 399 and Node 90 is still responsible for all addresses between 81-90. We 400 refer to non-client nodes as peers. 402 Other applications (for instance, SIP) can be defined on top of 403 RELOAD and use these two basic RELOAD services to provide their own 404 services. 406 1.2. Architecture 408 RELOAD is fundamentally an overlay network. Therefore, it can be 409 divided into components that mimic the layering of the Internet 410 model[RFC1122]. 412 Application 414 +-------+ +-------+ 415 | SIP | | XMPP | ... 416 | Usage | | Usage | 417 +-------+ +-------+ 418 -------------------------------------- Messaging API 419 +------------------+ +---------+ 420 | Message |<--->| Storage | 421 | Transport | +---------+ 422 +------------------+ ^ 423 ^ ^ | 424 | v v 425 | +-------------------+ 426 | | Topology | 427 | | Plugin | 428 | +-------------------+ 429 | ^ 430 v v 431 +------------------+ 432 | Forwarding & | 433 | Link Management | 434 +------------------+ 435 -------------------------------------- Overlay Link API 436 +-------+ +------+ 437 |TLS | |DTLS | ... 438 +-------+ +------+ 440 The major components of RELOAD are: 442 Usage Layer: Each application defines a RELOAD usage; a set of data 443 kinds and behaviors which describe how to use the services 444 provided by RELOAD. These usages all talk to RELOAD through a 445 common Message Transport API. 447 Message Transport: Handles the end-to-end reliability, manages 448 request state for the usages, and forwards Store and Fetch 449 operations to the Storage component. Delivers message responses 450 to the component initiating the request. 452 Storage: The Storage component is responsible for processing 453 messages relating to the storage and retrieval of data. It talks 454 directly to the Topology Plugin to manage data replication and 455 migration, and it talks to the Message Transport to send and 456 receive messages. 458 Topology Plugin: The Topology Plugin is responsible for implementing 459 the specific overlay algorithm being used. It uses the Message 460 Transport component to send and receive overlay management 461 messages, to the Storage component to manage data replication, and 462 directly to the Forwarding Layer to control hop-by-hop message 463 forwarding. This component closely parallels conventional routing 464 algorithms, but is more tightly coupled to the Forwarding Layer 465 because there is no single "routing table" equivalent used by all 466 overlay algorithms. 468 Forwarding and Link Management Layer: Stores and implements the 469 routing table by providing packet forwarding services between 470 nodes. It also handles establishing new links between nodes, 471 including setting up connections across NATs using ICE. 473 Overlay Link Layer: TLS [RFC5246] and DTLS [RFC4347] are the "link 474 layer" protocols used by RELOAD for hop-by-hop communication. 475 Each such protocol includes the appropriate provisions for per-hop 476 framing or hop-by-hop ACKs required by unreliable transports. 478 To further clarify the roles of the various layer, this figure 479 parallels the architecture with each layer's role from an overlay 480 perspective and implementation layer in the internet: 482 | Internet Model | 483 Real | Equivalent | Reload 484 Internet | in Overlay | Architecture 485 --------------+-----------------+------------------------------------ 486 | | +-------+ +-------+ 487 | Application | | SIP | | XMPP | ... 488 | | | Usage | | Usage | 489 | | +-------+ +-------+ 490 | | ---------------------------------- 491 | |+------------------+ +---------+ 492 | Transport || Message |<--->| Storage | 493 | || Transport | +---------+ 494 | |+------------------+ ^ 495 | | ^ ^ | 496 | | | v v 497 Application | | | +-------------------+ 498 | (Routing) | | | Topology | 499 | | | | Plugin | 500 | | | +-------------------+ 501 | | v ^ 502 | | v 503 | Network | +------------------+ 504 | | | Forwarding & | 505 | | | Link Management | 506 | | +------------------+ 507 | | ---------------------------------- 508 Transport | Link | +-------+ +------+ 509 | | |TLS | |DTLS | ... 510 | | +-------+ +------+ 511 --------------+-----------------+------------------------------------ 512 Network | 513 | 514 Link | 516 1.2.1. Usage Layer 518 The top layer, called the Usage Layer, has application usages, such 519 as the SIP Location Usage, that use the abstract Message Transport 520 API provided by RELOAD. The goal of this layer is to implement 521 application-specific usages of the generic overlay services provided 522 by RELOAD. The usage defines how a specific application maps its 523 data into something that can be stored in the overlay, where to store 524 the data, how to secure the data, and finally how applications can 525 retrieve and use the data. 527 The architecture diagram shows both a SIP usage and an XMPP usage. A 528 single application may require multiple usages, for example a SIP 529 application may also require a voicemail usage. A usage may define 530 multiple kinds of data that are stored in the overlay and may also 531 rely on kinds originally defined by other usages. 533 Because the security and storage policies for each kind are dictated 534 by the usage defining the kind, the usages may be coupled with the 535 Storage component to provide security policy enforcement and to 536 implement appropriate storage strategies according to the needs of 537 the usage. The exact implementation of such an interface is outside 538 the scope of this draft. 540 1.2.2. Message Transport 542 The Message Transport provides a generic message routing service for 543 the overlay. The Message Transport layer is responsible for end-to- 544 end message transactions, including retransmissions. Each peer is 545 identified by its location in the overlay as determined by its 546 Node-ID. A component that is a client of the Message Transport can 547 perform two basic functions: 549 o Send a message to a given peer specified by Node-ID or to the peer 550 responsible for a particular Resource-ID. 551 o Receive messages that other peers sent to a Node-ID or Resource-ID 552 for which this peer is responsible. 554 All usages rely on the Message Transport component to send and 555 receive messages from peers. For instance, when a usage wants to 556 store data, it does so by sending Store requests. Note that the 557 Storage component and the Topology Plugin are themselves clients of 558 the Message Transport, because they need to send and receive messages 559 from other peers. 561 The Message Transport API is similar to those described as providing 562 "Key based routing" (KBR), although as RELOAD supports different 563 overlay algorithms (including non-DHT overlay algorithms) that 564 calculate keys in different ways, the actual interface must accept 565 Resource Names rather than actual keys. 567 1.2.3. Storage 569 One of the major functions of RELOAD is to allow nodes to store data 570 in the overlay and to retrieve data stored by other nodes or by 571 themselves. The Storage component is responsible for processing data 572 storage and retrieval messages. For instance, the Storage component 573 might receive a Store request for a given resource from the Message 574 Transport. It would then query the appropriate usage before storing 575 the data value(s) in its local data store and sends a response to the 576 Message Transport for delivery to the requesting peer. Typically, 577 these messages will come for other nodes, but depending on the 578 overlay topology, a node might be responsible for storing data for 579 itself as well, especially if the overlay is small. 581 A peer's Node-ID determines the set of resources that it will be 582 responsible for storing. However, the exact mapping between these is 583 determined by the overlay algorithm used by the overlay. The Storage 584 component will only receive a Store request from the Message 585 Transport if this peer is responsible for that Resource-ID. The 586 Storage component is notified by the Topology Plugin when the 587 Resource-IDs for which it is responsible change, and the Storage 588 component is then responsible for migrating resources to other peers, 589 as required. 591 1.2.4. Topology Plugin 593 RELOAD is explicitly designed to work with a variety of overlay 594 algorithms. In order to facilitate this, the overlay algorithm 595 implementation is provided by a Topology Plugin so that each overlay 596 can select an appropriate overlay algorithm that relies on the common 597 RELOAD core protocols and code. 599 The Topology Plugin is responsible for maintaining the overlay 600 algorithm Routing Table, which is consulted by the Forwarding and 601 Link Management Layer before routing a message. When connections are 602 made or broken, the Forwarding and Link Management Layer notifies the 603 Topology Plugin, which adjusts the routing table as appropriate. The 604 Topology Plugin will also instruct the Forwarding and Link Management 605 Layer to form new connections as dictated by the requirements of the 606 overlay algorithm Topology. The Topology Plugin issues periodic 607 update requests through Message Transport to maintain and update its 608 Routing Table. 610 As peers enter and leave, resources may be stored on different peers, 611 so the Topology Plugin also keeps track of which peers are 612 responsible for which resources. As peers join and leave, the 613 Topology Plugin instructs the Storage component to issue resource 614 migration requests as appropriate, in order to ensure that other 615 peers have whatever resources they are now responsible for. The 616 Topology Plugin is also responsible for providing redundant data 617 storage to protect against loss of information in the event of a peer 618 failure and to protect against compromised or subversive peers. 620 1.2.5. Forwarding and Link Management Layer 622 The Forwarding and Link Management Layer is responsible for getting a 623 packet to the next peer, as determined by the Topology Plugin. This 624 Layer establishes and maintains the network connections as required 625 by the Topology Plugin. This layer is also responsible for setting 626 up connections to other peers through NATs and firewalls using ICE, 627 and it can elect to forward traffic using relays for NAT and firewall 628 traversal. 630 This layer provides a fairly generic interface that allows the 631 topology plugin control the overlay and resource operations and 632 messages. Since each overlay algorithm is defined and functions 633 differently, we generically refer to the table of other peers that 634 the overlay algorithm maintains and uses to route requests 635 (neighbors) as a Routing Table. The Topology Plugin actually owns 636 the Routing Table, and forwarding decisions are made by querying the 637 Topology Plugin for the next hop for a particular Node-ID or 638 Resource-ID. If this node is the destination of the message, the 639 message is delivered to the Message Transport. 641 The Forwarding and Link Management Layer sits on top of the Overlay 642 Link Layer protocols that carry the actual traffic. This 643 specification defines how to use DTLS and TLS protocols to carry 644 RELOAD messages. 646 1.3. Security 648 RELOAD's security model is based on each node having one or more 649 public key certificates. In general, these certificates will be 650 assigned by a central server which also assigns Node-IDs, although 651 self-signed certificates can be used in closed networks. These 652 credentials can be leveraged to provide communications security for 653 RELOAD messages. RELOAD provides communications security at three 654 levels: 656 Connection Level: Connections between peers are secured with TLS 657 or DTLS. 658 Message Level: Each RELOAD message must be signed. 659 Object Level: Stored objects must be signed by the storing peer. 661 These three levels of security work together to allow peers to verify 662 the origin and correctness of data they receive from other peers, 663 even in the face of malicious activity by other peers in the overlay. 664 RELOAD also provides access control built on top of these 665 communications security features. Because the peer responsible for 666 storing a piece of data can validate the signature on the data being 667 stored, the responsible peer can determine whether a given operation 668 is permitted or not. 670 RELOAD also provides a shared secret based admission control feature 671 using shared secrets and TLS-PSK. In order to form a TLS connection 672 to any node in the overlay, a new node needs to know the shared 673 overlay key, thus restricting access to authorized users. 675 1.4. Structure of This Document 677 The remainder of this document is structured as follows. 679 o Section 2 provides definitions of terms used in this document. 680 o Section 3 provides an overview of the mechanisms used to establish 681 and maintain the overlay. 682 o Section 4 provides an overview of the mechanism RELOAD provides to 683 support other applications. 684 o Section 5 defines the protocol messages that RELOAD uses to 685 establish and maintain the overlay. 686 o Section 6 defines the protocol messages that are used to store and 687 retrieve data using RELOAD. 688 o Section 7 defines the Certificate Store Usage that is fundamental 689 to RELOAD security. 690 o Section 8 defines the TURN Server Usage needed to locate TURN 691 servers for NAT traversal. 692 o Section 9 defines a specific Topology Plugin using Chord. 693 o Section 10 defines the mechanisms that new RELOAD nodes use to 694 join the overlay for the first time. 695 o Section 11 provides an extended example. 697 2. Terminology 699 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 700 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 701 document are to be interpreted as described in RFC 2119 [RFC2119]. 703 We use the terminology and definitions from the Concepts and 704 Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft 705 extensively in this document. Other terms used in this document are 706 defined inline when used and are also defined below for reference. 707 Terms which are new to this document (and perhaps should be added to 708 the concepts document) are marked with a (*). 710 DHT: A distributed hash table. A DHT is an abstract hash table 711 service realized by storing the contents of the hash table across 712 a set of peers. 714 Overlay Algorithm: An overlay algorithm defines the rules for 715 determining which peers in an overlay store a particular piece of 716 data and for determining a topology of interconnections amongst 717 peers in order to find a piece of data. 719 Overlay Instance: A specific overlay algorithm and the collection of 720 peers that are collaborating to provide read and write access to 721 it. There can be any number of overlay instances running in an IP 722 network at a time, and each operates in isolation of the others. 724 Peer: A host that is participating in the overlay. Peers are 725 responsible for holding some portion of the data that has been 726 stored in the overlay and also route messages on behalf of other 727 hosts as required by the Overlay Algorithm. 729 Client: A host that is able to store data in and retrieve data from 730 the overlay but which is not participating in routing or data 731 storage for the overlay. 733 Node: We use the term "Node" to refer to a host that may be either a 734 Peer or a Client. Because RELOAD uses the same protocol for both 735 clients and peers, much of the text applies equally to both. 736 Therefore we use "Node" when the text applies to both Clients and 737 Peers and the more specific term when the text applies only to 738 Clients or only to Peers. 740 Node-ID: A 128-bit value that uniquely identifies a node. Node-IDs 741 0 and 2^128 - 1 are reserved and are invalid Node-IDs. A value of 742 zero is not used in the wire protocol but can be used to indicate 743 an invalid node in implementations and APIs. The Node-ID of 744 2^128-1 is used on the wire protocol as a wildcard. (*) 746 Resource: An object or group of objects associated with a string 747 identifier see "Resource Name" below. 749 Resource Name: The potentially human readable name by which a 750 resource is identified. In unstructured P2P networks, the 751 resource name is sometimes used directly as a Resource-ID. In 752 structured P2P networks the resource name is typically mapped into 753 a Resource-ID by using the string as the input to hash function. 754 A SIP resource, for example, is often identified by its AOR which 755 is an example of a Resource Name.(*) 757 Resource-ID: A value that identifies some resources and which is 758 used as a key for storing and retrieving the resource. Often this 759 is not human friendly/readable. One way to generate a Resource-ID 760 is by applying a mapping function to some other unique name (e.g., 761 user name or service name) for the resource. The Resource-ID is 762 used by the distributed database algorithm to determine the peer 763 or peers that are responsible for storing the data for the 764 overlay. In structured P2P networks, Resource-IDs are generally 765 fixed length and are formed by hashing the resource name. In 766 unstructured networks, resource names may be used directly as 767 Resource-IDs and may have variable length. 769 Connection Table: The set of peers to which a node is directly 770 connected. This includes nodes with which Attach handshakes have 771 been done but which have not sent any Updates. 773 Routing Table: The set of peers which a node can use to route 774 overlay messages. In general, these peers will all be on the 775 connection table but not vice versa, because some peers will have 776 Attached but not sent updates. Peers may send messages directly 777 to peers which are on the connection table but may only route 778 messages to other peers through peers which are on the routing 779 table. (*) 781 Destination List: A list of IDs through which a message is to be 782 routed. A single Node-ID is a trivial form of destination list. 783 (*) 785 Usage: A usage is an application that wishes to use the overlay for 786 some purpose. Each application wishing to use the overlay defines 787 a set of data kinds that it wishes to use. The SIP usage defines 788 the location data kind. (*) 790 3. Overlay Management Overview 792 The most basic function of RELOAD is as a generic overlay network. 793 Nodes need to be able to join the overlay, form connections to other 794 nodes, and route messages through the overlay to nodes to which they 795 are not directly connected. This section provides an overview of the 796 mechanisms that perform these functions. 798 3.1. Security and Identification 800 Every node in the RELOAD overlay is identified by a Node-ID. The 801 Node-ID is used for three major purposes: 803 o To address the node itself. 804 o To determine its position in the overlay topology when the overlay 805 is structured. 806 o To determine the set of resources for which the node is 807 responsible. 809 Each node has a certificate [RFC3280] containing a Node-ID, which is 810 globally unique. 812 The certificate serves multiple purposes: 814 o It entitles the user to store data at specific locations in the 815 Overlay Instance. Each data kind defines the specific rules for 816 determining which certificates can access each Resource-ID/Kind-ID 817 pair. For instance, some kinds might allow anyone to write at a 818 given location, whereas others might restrict writes to the owner 819 of a single certificate. 820 o It entitles the user to operate a node that has a Node-ID found in 821 the certificate. When the node forms a connection to another 822 peer, it can use this certificate so that a node connecting to it 823 knows it is connected to the correct node. In addition, the node 824 can sign messages, thus providing integrity and authentication for 825 messages which are sent from the node. 826 o It entitles the user to use the user name found in the 827 certificate. 829 If a user has more than one device, typically they would get one 830 certificate for each device. This allows each device to act as a 831 separate peer. 833 RELOAD supports two certificate issuance models. The first is based 834 on a central enrollment process which allocates a unique name and 835 Node-ID to the node a certificate for a public/private key pair for 836 the user. All peers in a particular Overlay Instance have the 837 enrollment server as a trust anchor and so can verify any other 838 peer's certificate. 840 In some settings, a group of users want to set up an overlay network 841 but are not concerned about attack by other users in the network. 842 For instance, users on a LAN might want to set up a short term ad hoc 843 network without going to the trouble of setting up an enrollment 844 server. RELOAD supports the use of self-generated and self-signed 845 certificates. When self-signed certificates are used, the node also 846 generates its own Node-ID and username. The Node-ID is computed as a 847 digest of the public key, to prevent Node-ID theft, however this 848 model is still subject to a number of known attacks (most notably 849 Sybil attacks [Sybil]) and can only be safely used in closed networks 850 where users are mutually trusting. 852 The general principle here is that the security mechanisms (TLS and 853 message signatures) are always used, even if the certificates are 854 self-signed. This allows for a single set of code paths in the 855 systems with the only difference being whether certificate 856 verification is required to chain to a single root of trust. 858 3.1.1. Shared-Key Security 860 RELOAD also provides an admission control system based on shared 861 keys. In this model, the peers all share a single key which is used 862 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 864 3.2. Clients 866 RELOAD defines a single protocol that is used both as the peer 867 protocol and the client protocol for the overlay. This simplifies 868 implementation, particularly for devices that may act in either role, 869 and allows clients to inject messages directly into the overlay. 871 We use the term "peer" to identify a node in the overlay that routes 872 messages for nodes other than those to which it is directly 873 connected. Peers typically also have storage responsibilities. We 874 use the term "client" to refer to nodes that do not have routing or 875 storage responsibilities. When text applies to both peers and 876 clients, we will simply refer to such a device as a "node." 878 RELOAD's client support allows nodes that are not participating in 879 the overlay as peers to utilize the same implementation and to 880 benefit from the same security mechanisms as the peers. Clients 881 possess and use certificates that authorize the user to store data at 882 its locations in the overlay. The Node-ID in the certificate is used 883 to identify the particular client as a member of the overlay and to 884 authenticate its messages. 886 For more discussion of the motivation for RELOAD's client support, 887 see Appendix C. 889 3.2.1. Client Routing 891 There are two routing options by which a client may be located in an 892 overlay. 894 o Establish a connection to the peer responsible for the client's 895 Node-ID in the overlay. Then requests may be sent from/to the 896 client using its Node-ID in the same manner as if it were a peer, 897 because the responsible peer in the overlay will handle the final 898 step of routing to the client. This will not work in overlays 899 where NAT or firewall do not allow all clients to form connections 900 with any other peer. 901 o Establish a connection with an arbitrary peer in the overlay 902 (perhaps based on network proximity or an inability to establish a 903 direct connection with the responsible peer). In this case, the 904 client will rely on RELOAD's Destination List feature to ensure 905 reachability. The client can initiate requests, and any node in 906 the overlay that knows the Destination List to its current 907 location can reach it, but the client is not directly reachable 908 directly using only its Node-ID. The Destination List required to 909 reach it must be learnable via other mechanisms, such as being 910 stored in the overlay by a usage, if the client is to receive 911 incoming requests from other members of the overlay. 913 3.2.2. Minimum Functionality Requirements for Clients 915 A node may act as a client simply because it does not have the 916 resources or even an implementation of the topology plugin required 917 to acts as a peer in the overlay. In order to exchange RELOAD 918 messages with a peer, a client must meet a minimum level of 919 functionality. Such a client must: 921 o Implement RELOAD's connection-management connections that are used 922 to establish the connection with the peer. 923 o Implement RELOAD's data retrieval methods (with client 924 functionality). 925 o Be able to calculate Resource-IDs used by the overlay. 926 o Possess security credentials required by the overlay it is 927 implementing. 929 A client speaks the same protocol as the peers, knows how to 930 calculate Resource-IDs, and signs its requests in the same manner as 931 peers. While a client does not necessarily require a full 932 implementation of the overlay algorithm, calculating the Resource-ID 933 requires an implementation of the appropriate algorithm for the 934 overlay. 936 RELOAD does not support a separate protocol for clients that do not 937 meet these functionality requirements. Any such extension would 938 either entail compromises on the features of RELOAD or require an 939 entirely new protocol to reimplement the core features of RELOAD. 940 Furthermore, for SIP and many other applications, a native 941 application-level protocol already exists that is sufficient for such 942 a client to interact with a member of the RELOAD overlay. 944 3.3. Routing 946 This section will discuss the requirements RELOAD's routing 947 capabilities must meet, then describe the routing features in the 948 protocol, and provide a brief overview of how they are used. 949 Appendix B discusses some alternative designs and the tradeoffs that 950 would be necessary to support them. 952 RELOAD's routing capabilities must meet the following requirements: 954 NAT Traversal: RELOAD must support establishing and using 955 connections between nodes separated by one or more NATs, including 956 locating peers behind NATs for those overlays allowing/requiring 957 it. 958 Clients: RELOAD must support requests from and to clients that do 959 not participate in overlay routing. 960 Client promotion: RELOAD must support clients that become peers at a 961 later point as determined by the overlay algorithm and deployment. 962 Low state: RELOAD's routing algorithms must not require 963 significant state to be stored on intermediate peers. 964 Return routability in unstable topologies: At some points in 965 times, different nodes may have inconsistent information about the 966 connectivity of the routing graph. In all cases, the response to 967 a request needs to delivered to the node that sent the request and 968 not to some other node. 970 To meet these requirements, RELOAD's routing relies on two basic 971 mechanisms: 973 Via Lists: The forwarding header used by all RELOAD messages 974 contains both a Via List (built hop-by-hop as the message is 975 routed through the overlay) and a Destination List (providing 976 source-routing capabilities for requests and return-path routing 977 for responses). 978 Route_Query: The Route_Query method allows a node to query a peer 979 for the next hop it will use to route a message. This method is 980 useful for diagnostics and for iterative routing. 982 The basic routing mechanism used by RELOAD is Symmetric Recursive. 983 We will first describe symmetric routing and then discuss its 984 advantages in terms of the requirements discussed above. 986 Symmetric recursive routing requires a message follow the path 987 through the overlay to the destination without returning to the 988 originating node: each peer forwards the message closer to its 989 destination. The return path of the response is then the same path 990 followed in reverse. For example, a message following a route from A 991 to Z through B and X: 993 A B X Z 994 ------------------------------- 996 ----------> 997 Dest=Z 998 ----------> 999 Via=A 1000 Dest=Z 1001 ----------> 1002 Via=A, B 1003 Dest=Z 1005 <---------- 1006 Dest=X, B, A 1007 <---------- 1008 Dest=B, A 1009 <---------- 1010 Dest=A 1012 Note that the preceding Figure does not indicate whether A is a 1013 client or peer, A forwards its request to B and the response is 1014 returned to A in the same manner regardless of A's role in the 1015 overlay. 1017 This figure shows use of full via-lists by intermediate peers B and 1018 X. However, if B and/or X are willing to store state, then they may 1019 elect to truncate the lists, save that information internally (keyed 1020 by the transaction id), and return the response message along the 1021 path from which it was received when the response is received. This 1022 option requires greater state on intermediate peers but saves a small 1023 amount of bandwidth and reduces the need for modifying the message in 1024 route. Selection of this mode of operation is a choice for the 1025 individual peer, the techniques are interoperable even on a single 1026 message. The figure below shows B using full via lists but X 1027 truncating them and saving the state internally. 1029 A B X Z 1030 ------------------------------- 1032 ----------> 1033 Dest=Z 1034 ----------> 1035 Via=A 1036 Dest=Z 1037 ----------> 1038 Dest=Z 1040 <---------- 1041 Dest=X 1042 <---------- 1043 Dest=B, A 1044 <---------- 1045 Dest=A 1047 For debugging purposes, a Route Log attribute is available that 1048 stores information about each peer as the message is forwarded. 1050 RELOAD also supports a basic Iterative routing mode (where the 1051 intermediate peers merely return a response indicating the next hop, 1052 but do not actually forward the message to that next hop themselves). 1053 Iterative routing is implemented using the Route_Query method, which 1054 requests this behavior. Note that iterative routing is selected only 1055 by the initiating node. RELOAD does not support an intermediate peer 1056 returning a response that it will not recursively route a normal 1057 request. The willingness to perform that operation is implicit in 1058 its role as a peer in the overlay. 1060 3.4. Connectivity Management 1062 In order to provide efficient routing, a peer needs to maintain a set 1063 of direct connections to other peers in the Overlay Instance. Due to 1064 the presence of NATs, these connections often cannot be formed 1065 directly. Instead, we use the Attach request to establish a 1066 connection. Attach uses ICE [I-D.ietf-mmusic-ice-tcp] to establish 1067 the connection. It is assumed that the reader is familiar with ICE. 1069 Say that peer A wishes to form a direct connection to peer B. It 1070 gathers ICE candidates and packages them up in an Attach request 1071 which it sends to B through usual overlay routing procedures. B does 1072 its own candidate gathering and sends back a response with its 1073 candidates. A and B then do ICE connectivity checks on the candidate 1074 pairs. The result is a connection between A and B. At this point, A 1075 and B can add each other to their routing tables and send messages 1076 directly between themselves without going through other overlay 1077 peers. 1079 There is one special case in which Attach cannot be used: when a 1080 peer is joining the overlay and is not connected to any peers. In 1081 order to support this case, some small number of "bootstrap nodes" 1082 need to be publicly accessible so that new peers can directly connect 1083 to them. Section 10 contains more detail on this. 1085 In general, a peer needs to maintain connections to all of the peers 1086 near it in the Overlay Instance and to enough other peers to have 1087 efficient routing (the details depend on the specific overlay). If a 1088 peer cannot form a connection to some other peer, this isn't 1089 necessarily a disaster; overlays can route correctly even without 1090 fully connected links. However, a peer should try to maintain the 1091 specified link set and if it detects that it has fewer direct 1092 connections, should form more as required. This also implies that 1093 peers need to periodically verify that the connected peers are still 1094 alive and if not try to reform the connection or form an alternate 1095 one. 1097 3.5. Overlay Algorithm Support 1099 The Topology Plugin allows RELOAD to support a variety of overlay 1100 algorithms. This draft defines a DHT based on Chord [Chord], which 1101 is mandatory to implement, but the base RELOAD protocol is designed 1102 to support a variety of overlay algorithms. 1104 3.5.1. Support for Pluggable Overlay Algorithms 1106 RELOAD defines three methods for overlay maintenance: Join, Update, 1107 and Leave. However, the contents of those messages, when they are 1108 sent, and their precise semantics are specified by the actual overlay 1109 algorithm; RELOAD merely provides a framework of commonly-needed 1110 methods that provides uniformity of notation (and ease of debugging) 1111 for a variety of overlay algorithms. 1113 3.5.2. Joining, Leaving, and Maintenance Overview 1115 When a new peer wishes to join the Overlay Instance, it must have a 1116 Node-ID that it is allowed to use. It uses the Node-ID in the 1117 certificate it received from the enrollment server. The details of 1118 the joining procedure are defined by the overlay algorithm, but the 1119 general steps for joining an Overlay Instance are: 1121 o Forming connections to some other peers. 1122 o Acquiring the data values this peer is responsible for storing. 1124 o Informing the other peers which were previously responsible for 1125 that data that this peer has taken over responsibility. 1127 The first thing the peer needs to do is form a connection to some 1128 "bootstrap node". Because this is the first connection the peer 1129 makes, these nodes must have public IP addresses and therefore can be 1130 connected to directly. Once a peer has connected to one or more 1131 bootstrap nodes, it can form connections in the usual way by routing 1132 Attach messages through the overlay to other nodes. Once a peer has 1133 connected to the overlay for the first time, it can cache the set of 1134 nodes it has connected to with public IP addresses for use as future 1135 bootstrap nodes. 1137 Once the peer has connected to a bootstrap node, it then needs to 1138 take up its appropriate place in the overlay. This requires two 1139 major operations: 1141 o Forming connections to other peers in the overlay to populate its 1142 Routing Table. 1143 o Getting a copy of the data it is now responsible for storing and 1144 assuming responsibility for that data. 1146 The second operation is performed by contacting the Admitting Peer 1147 (AP), the node which is currently responsible for that section of the 1148 overlay. 1150 The details of this operation depend mostly on the overlay algorithm 1151 involved, but a typical case would be: 1153 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1154 announcing its intention to join. 1155 2. AP sends a Join response. 1156 3. AP does a sequence of Stores to JP to give it the data it will 1157 need. 1158 4. AP does Updates to JP and to other peers to tell it about its own 1159 routing table. At this point, both JP and AP consider JP 1160 responsible for some section of the Overlay Instance. 1161 5. JP makes its own connections to the appropriate peers in the 1162 Overlay Instance. 1164 After this process is completed, JP is a full member of the Overlay 1165 Instance and can process Store/Fetch requests. 1167 Note that the first node is a special case. When ordinary nodes 1168 cannot form connections to the bootstrap nodes, then they are not 1169 part of the overlay. However, the first node in the overlay can 1170 obviously not connect to others nodes. In order to support this 1171 case, potential first nodes (which must also serve as bootstrap nodes 1172 initially) must somehow be instructed (perhaps by configuration 1173 settings) that they are the entire overlay, rather than not part of 1174 it. 1176 3.6. First-Time Setup 1178 Previous sections addressed how RELOAD works once a node has 1179 connected. This section provides an overview of how users get 1180 connected to the overlay for the first time. RELOAD is designed so 1181 that users can start with the name of the overlay they wish to join 1182 and perhaps a username and password, and leverage that into having a 1183 working peer with minimal user intervention. This helps avoid the 1184 problems that have been experienced with conventional SIP clients 1185 where users are required to manually configure a large number of 1186 settings. 1188 3.6.1. Initial Configuration 1190 In the first phase of the process, the user starts out with the name 1191 of the overlay and uses this to download an initial set of overlay 1192 configuration parameters. The user does a DNS SRV lookup on the 1193 overlay name to get the address of a configuration server. It can 1194 then connect to this server with HTTPS to download a configuration 1195 document which contains the basic overlay configuration parameters as 1196 well as a set of bootstrap nodes which can be used to join the 1197 overlay. 1199 3.6.2. Enrollment 1201 If the overlay is using centralized enrollment, then a user needs to 1202 acquire a certificate before joining the overlay. The certificate 1203 attests both to the user's name within the overlay and to the Node- 1204 IDs which they are permitted to operate. In that case, the 1205 configuration document will contain the address of an enrollment 1206 server which can be used to obtain such a certificate. The 1207 enrollment server may (and probably will) require some sort of 1208 username and password before issuing the certificate. The enrollment 1209 server's ability to restrict attackers' access to certificates in the 1210 overlay is one of the cornerstones of RELOAD's security. 1212 4. Application Support Overview 1214 RELOAD is not intended to be used alone, but rather as a substrate 1215 for other applications. These applications can use RELOAD for a 1216 variety of purposes: 1218 o To store data in the overlay and retrieve data stored by other 1219 nodes. 1220 o As a discovery mechanism for services such as TURN. 1221 o To form direct connections which can be used to transmit 1222 application-level messages. 1224 This section provides an overview of these services. 1226 4.1. Data Storage 1228 RELOAD provides operations to Store and Fetch data. Each location in 1229 the Overlay Instance is referenced by a Resource-ID. However, each 1230 location may contain data elements corresponding to multiple kinds 1231 (e.g., certificate, SIP registration). Similarly, there may be 1232 multiple elements of a given kind, as shown below: 1234 +--------------------------------+ 1235 | Resource-ID | 1236 | | 1237 | +------------+ +------------+ | 1238 | | Kind 1 | | Kind 2 | | 1239 | | | | | | 1240 | | +--------+ | | +--------+ | | 1241 | | | Value | | | | Value | | | 1242 | | +--------+ | | +--------+ | | 1243 | | | | | | 1244 | | +--------+ | | +--------+ | | 1245 | | | Value | | | | Value | | | 1246 | | +--------+ | | +--------+ | | 1247 | | | +------------+ | 1248 | | +--------+ | | 1249 | | | Value | | | 1250 | | +--------+ | | 1251 | +------------+ | 1252 +--------------------------------+ 1254 Each kind is identified by a Kind-ID, which is a code point assigned 1255 by IANA. As part of the kind definition, protocol designers may 1256 define constraints, such as limits on size, on the values which may 1257 be stored. For many kinds, the set may be restricted to a single 1258 value; some sets may be allowed to contain multiple identical items 1259 while others may only have unique items. Note that a kind may be 1260 employed by multiple usages and new usages are encouraged to use 1261 previously defined kinds where possible. We define the following 1262 data models in this document, though other usages can define their 1263 own structures: 1265 single value: There can be at most one item in the set and any value 1266 overwrites the previous item. 1268 array: Many values can be stored and addressed by a numeric index. 1270 dictionary: The values stored are indexed by a key. Often this key 1271 is one of the values from the certificate of the peer sending the 1272 Store request. 1274 In order to protect stored data from tampering, by other nodes, each 1275 stored value is digitally signed by the node which created it. When 1276 a value is retrieved, the digital signature can be verified to detect 1277 tampering. 1279 4.1.1. Storage Permissions 1281 A major issue in peer-to-peer storage networks is minimizing the 1282 burden of becoming a peer, and in particular minimizing the amount of 1283 data which any peer is required to store for other nodes. RELOAD 1284 addresses this issue by only allowing any given node to store data at 1285 a small number of locations in the overlay, with those locations 1286 being determined by the node's certificate. When a peer uses a Store 1287 request to place data at a location authorized by its certificate, it 1288 signs that data with the private key that corresponds to its 1289 certificate. Then the peer responsible for storing the data is able 1290 to verify that the peer issuing the request is authorized to make 1291 that request. Each data kind defines the exact rules for determining 1292 what certificate is appropriate. 1294 The most natural rule is that a certificate authorizes a user to 1295 store data keyed with their user name X. This rules is used for all 1296 the kinds defined in this specification. Thus, only a user with a 1297 certificate for "alice@example.org" could write to that location in 1298 the overlay. However, other usages can define any rules they choose, 1299 including publicly writable values. 1301 The digital signature over the data serves two purposes. First, it 1302 allows the peer responsible for storing the data to verify that this 1303 Store is authorized. Second, it provides integrity for the data. 1304 The signature is saved along with the data value (or values) so that 1305 any reader can verify the integrity of the data. Of course, the 1306 responsible peer can "lose" the value but it cannot undetectable 1307 modify it. 1309 The size requirements of the data being stored in the overlay are 1310 variable. For instance, a SIP AoR and voicemail differ widely in the 1311 storage size. RELOAD leaves it to the Usage and overlay 1312 configuration to address the size imbalance of various kinds. 1314 4.1.2. Usages 1316 By itself, the distributed storage layer just provides infrastructure 1317 on which applications are built. In order to do anything useful, a 1318 usage must be defined. Each Usage specifies several things: 1320 o Registers Kind-ID code points for any kinds that the Usage 1321 defines. 1322 o Defines the data structure for each of the kinds. 1323 o Defines access control rules for each kinds. 1324 o Defines how the Resource Name is formed that is hashed to form the 1325 Resource-ID where each kind is stored. 1326 o Describes how values will be merged after a network partition. 1327 Unless otherwise specified, the default merging rule is to act as 1328 if all the values that need to be merged were stored and that the 1329 order they were stored in corresponds to the stored time values 1330 associated with (and carried in) their values. Because the stored 1331 time values are those associated with the peer which did the 1332 writing, clock skew is generally not an issue. If two nodes are 1333 on different partitions, clocks, this can create merge conflicts. 1334 However because RELOAD deliberately segregates storage so that 1335 data from different users and peers is stored in different 1336 locations, and a single peer will typically only be in a single 1337 network partition, this case will generally not arise. 1339 The kinds defined by a usage may also be applied to other usages. 1340 However, a need for different parameters, such as different size 1341 limits, would imply the need to create a new kind. 1343 4.1.3. Replication 1345 Replication in P2P overlays can be used to provide: 1347 persistence: if the responsible peer crashes and/or if the storing 1348 peer leaves the overlay 1349 security: to guard against DoS attacks by the responsible peer or 1350 routing attacks to that responsible peer 1351 load balancing: to balance the load of queries for popular 1352 resources. 1354 A variety of schemes are used in P2P overlays to achieve some of 1355 these goals. Common techniques include replicating on neighbors of 1356 the responsible peer, randomly locating replicas around the overlay, 1357 or replicating along the path to the responsible peer. 1359 The core RELOAD specification does not specify a particular 1360 replication strategy. Instead, the first level of replication 1361 strategies are determined by the overlay algorithm, which can base 1362 the replication strategy on the its particular topology. For 1363 example, Chord places replicas on successor peers, which will take 1364 over responsibility should the responsible peer fail [Chord]. 1366 If additional replication is needed, for example if data persistence 1367 is particularly important for a particular usage, then that usage may 1368 specify additional replication, such as implementing random 1369 replications by inserting a different well known constant into the 1370 Resource Name used to store each replicated copy of the resource. 1371 Such replication strategies can be added independent of the 1372 underlying algorithm, and their usage can be determined based on the 1373 needs of the particular usage. 1375 4.2. Service Discovery 1377 RELOAD does not currently define a generic service discovery 1378 algorithm as part of the base protocol; although a TURN-specific 1379 discovery mechanism is provided. A variety of service discovery 1380 algorithm can be implemented as extensions to the base protocol, such 1381 as ReDIR [opendht-sigcomm05]. 1383 4.3. Application Connectivity 1385 There is no requirement that a RELOAD usage must use RELOAD's 1386 primitives for establishing its own communication if it already 1387 possesses its own means of establishing connections. For example, 1388 one could design a RELOAD-based resource discovery protocol which 1389 used HTTP to retrieve the actual data. 1391 For more common situations, however, the overlay itself is used to 1392 establish a connection rather than an external authority such as DNS, 1393 RELOAD provides connectivity to applications using the same Attach 1394 method as is used for the overlay maintenance. For example, if a 1395 P2PSIP node wishes to establish a SIP dialog with another P2PSIP 1396 node, it will use Attach to establish a direct connection with the 1397 other node. This new connection is separate from the peer protocol 1398 connection, it is a dedicated UDP or TCP flow used only for the SIP 1399 dialog. Each usage specifies which types of connections can be 1400 initiated using Attach. 1402 5. Overlay Management Protocol 1404 This section defines the basic protocols used to create, maintain, 1405 and use the RELOAD overlay network. We start by defining the basic 1406 concept of how message destinations are interpreted when routing 1407 messages. We then describe the symmetric recursive routing model, 1408 which is RELOAD's default routing algorithm. We then define the 1409 message structure and then finally define the messages used to join 1410 and maintain the overlay. 1412 5.1. Message Receipt and Forwarding 1414 When a peer receives a message, it first examines the overlay, 1415 version, and other header fields to determine whether the message is 1416 one it can process. If any of these are incorrect (e.g., the message 1417 is for an overlay in which the peer does not participate) it is an 1418 error. The peer SHOULD generate an appropriate error but local 1419 policy can override this and cause the messages is silently dropped. 1421 Once the peer has determined that the message is correctly formatted, 1422 it examines the first entry on the destination list. There are three 1423 possible cases here: 1425 o The first entry on the destination list is an id for which the 1426 peer is responsible. 1427 o The first entry on the destination list is a an id for which 1428 another peer is responsible. 1429 o The first entry on the destination list is a private id which is 1430 being used for destination list compression. 1432 These cases are handled as discussed below. 1434 5.1.1. Responsible ID 1436 If the first entry on the destination list is a ID for which the node 1437 is responsible, there are several sub-cases. 1438 o If the entry is a Resource-ID, then it MUST be the only entry on 1439 the destination list. If there are other entries, the message 1440 MUST be silently dropped. Otherwise, the message is destined for 1441 this node and it passes it up to the upper layers. 1442 o If the entry is a Node-ID which belongs to this node, then the 1443 message is destined for this node. If this is the only entry on 1444 the destination list, the message is destined for this node and is 1445 passed up to the upper layers. Otherwise the entry is removed 1446 from the destination list and the message is passed it to the 1447 Message Transport. If the message is a response and there is 1448 state for the transaction ID, the state is reinserted into the 1449 destination list first. 1450 o If the entry is a Node-ID which is not equal to this node, then 1451 the node MUST drop the message silently unless the Node-ID 1452 corresponds to a node which is directly connected to this node 1453 (i.e., a client). In that case, it MUST forward the message to 1454 the destination node as described in the next section. 1456 Note that this implies that in order to address a message to "the 1457 peer that controls region X", a sender sends to Resource-ID X, not 1458 Node-ID X. 1460 5.1.2. Other ID 1462 If neither of the other two cases applies, then the peer MUST forward 1463 the message towards the first entry on the destination list. This 1464 means that it MUST select one of the peers to which it is connected 1465 and which is likely to be responsible for the first entry on the 1466 destination list. If the first entry on the destination list is in 1467 the peer's connection table, then it SHOULD forward the message to 1468 that peer directly. Otherwise, it consult the routing table to 1469 forward the message. 1471 Any intermediate peer which forwards a RELOAD message MUST arrange 1472 that if it receives a response to that message the response can be 1473 routed back through the set of nodes through which the request 1474 passed. This may be arranged in one of two ways: 1476 o The peer MAY add an entry to the via list in the forwarding header 1477 that will enable it to determine the correct node. 1478 o The peer MAY keep per-transaction state which will allow it to 1479 determine the correct node. 1481 As an example of the first strategy, if node D receives a message 1482 from node C with via list (A, B), then D would forward to the next 1483 node (E) with via list (A, B, C). Now, if E wants to respond to the 1484 message, it reverses the via list to produce the destination list, 1485 resulting in (D, C, B, A). When D forwards the response to C, the 1486 destination list will contain (C, B, A). 1488 As an example of the second strategy, if node D receives a message 1489 from node C with transaction ID X and via list (A, B), it could store 1490 (X, C) in its state database and forward the message with the via 1491 list unchanged. When D receives the response, it consults its state 1492 database for transaction id X, determines that the request came from 1493 C, and forwards the response to C. 1495 Intermediate peer which modify the via list are not required to 1496 simply add entries. The only requirement is that the peer be able to 1497 reconstruct the correct destination list on the return route. RELOAD 1498 provides explicit support for this functionality in the form of 1499 private IDs, which can replace any number of via list entries. For 1500 instance, in the above example, Node D might send E a via list 1501 containing only the private ID (I). E would then use the destination 1502 list (D, I) to send its return message. When D processes this 1503 destination list, it would detect that I is a private ID, recover the 1504 via list (A, B, C), and reverse that to produce the correct 1505 destination list (C, B, A) before sending it to C. This feature is 1506 called List Compression. I MAY either be a compressed version of the 1507 original via list or an index into a state database containing the 1508 original via list. 1510 Note that if an intermediate peer exits the overlay, then on the 1511 return trip the message cannot be forwarded and will be dropped. The 1512 ordinary timeout and retransmission mechanisms provide stability over 1513 this type of failure. 1515 5.1.3. Private ID 1517 If the first entry on the destination list is a private id (e.g., a 1518 compressed via list), the peer MUST that entry with the original via 1519 list that it replaced indexes and then re-examine the destination 1520 list to determine which case now applies. 1522 5.2. Symmetric Recursive Routing 1524 This Section defines RELOAD's symmetric recursive routing algorithm, 1525 which is the default algorithm used by nodes to route messages 1526 through the overlay. All implementations MUST implement this routing 1527 algorithm. An overlay may be configured to use alternative routing 1528 algorithms, and alternative routing algorithms may be selected on a 1529 per-message basis. 1531 5.2.1. Request Origination 1533 In order to originate a message to a given Node-ID or Resource-ID, a 1534 node constructs an appropriate destination list. The simplest such 1535 destination list is a single entry containing the peer or 1536 Resource-ID. The resulting message will use the normal overlay 1537 routing mechanisms to forward the message to that destination. The 1538 node can also construct a more complicated destination list for 1539 source routing. 1541 Once the message is constructed, the node sends the message to some 1542 adjacent peer. If the first entry on the destination list is 1543 directly connected, then the message MUST be routed down that 1544 connection. Otherwise, the topology plugin MUST be consulted to 1545 determine the appropriate next hop. 1547 Parallel searches for the resource are a common solution to improve 1548 reliability in the face of churn or of subversive peers. Parallel 1549 searches for usage-specified replicas are managed by the usage layer. 1550 However, a single request can also be routed through multiple 1551 adjacent peers, even when known to be sub-optimal, to improve 1552 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1553 specified by the topology plugin. 1555 Because messages may be lost in transit through the overlay, RELOAD 1556 incorporates an end-to-end reliability mechanism. When an 1557 originating node transmits a request it MUST set a 3 second timer. 1558 If a response has not been received when the timer fires, the request 1559 is retransmitted with the same transaction identifier. The request 1560 MAY be retransmitted up to 4 times (for a total of 5 messages). 1561 After the timer for the fifth transmission fires, the message SHALL 1562 be considered to have failed. Note that this retransmission 1563 procedure is not followed by intermediate nodes. They follow the 1564 hop-by-hop reliability procedure described in Section 5.6.2. 1566 The above algorithm can result in multiple requests being delivered 1567 to a node. Receiving nodes MUST generate semantically equivalent 1568 responses to retransmissions of the same request (this can be 1569 determined by transaction id) if the request is received within the 1570 maximum request lifetime (15 seconds). For some requests (e.g., 1571 FETCH) this can be accomplished merely by processing the request 1572 again. For other requests, (e.g., STORE) it may be necessary to 1573 maintain state for the duration of the request lifetime. 1575 5.2.2. Response Origination 1577 When a peer sends a response to a request, it MUST construct the 1578 destination list by reversing the order of the entries on the via 1579 list. This has the result that the response traverses the same peers 1580 as the request traversed, except in reverse order (symmetric 1581 routing). 1583 5.3. Message Structure 1585 RELOAD is a message-oriented request/response protocol. The messages 1586 are encoded using binary fields. All integers are represented in 1587 network byte order. The general philosophy behind the design was to 1588 use Type, Length, Value fields to allow for extensibility. However, 1589 for the parts of a structure that were required in all messages, we 1590 just define these in a fixed position as adding a type and length for 1591 them is unnecessary and would simply increase bandwidth and 1592 introduces new potential for interoperability issues. 1594 Each message has three parts, concatenated as shown below: 1596 +-------------------------+ 1597 | Forwarding Header | 1598 +-------------------------+ 1599 | Message Contents | 1600 +-------------------------+ 1601 | Security Block | 1602 +-------------------------+ 1604 The contents of these parts are as follows: 1606 Forwarding Header: Each message has a generic header which is used 1607 to forward the message between peers and to its final destination. 1608 This header is the only information that an intermediate peer 1609 (i.e., one that is not the target of a message) needs to examine. 1611 Message Contents: The message being delivered between the peers. 1612 From the perspective of the forwarding layer, the contents is 1613 opaque, however, it is interpreted by the higher layers. 1615 Security Block: A security block containing certificates and a 1616 digital signature over the message. Note that this signature can 1617 be computed without parsing the message contents. All messages 1618 MUST be signed by their originator. 1620 The following sections describe the format of each part of the 1621 message. 1623 5.3.1. Presentation Language 1625 The structures defined in this document are defined using a C-like 1626 syntax based on the presentation language used to define TLS. 1627 Advantages of this style include: 1629 o It is easy to write and familiar enough looking that most readers 1630 can grasp it quickly. 1631 o The ability to define nested structures allows a separation 1632 between high-level and low level message structures. 1633 o It has a straightforward wire encoding that allows quick 1634 implementation, but the structures can be comprehended without 1635 knowing the encoding. 1636 o The ability to mechanically (compile) encoders and decoders. 1638 This presentation is to some extent a placeholder. We consider it an 1639 open question what the final protocol definition method and encodings 1640 use. We expect this to be a question for the WG to decide. 1642 Several idiosyncrasies of this language are worth noting. 1644 o All lengths are denoted in bytes, not objects. 1645 o Variable length values are denoted like arrays with angle 1646 brackets. 1647 o "select" is used to indicate variant structures. 1649 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1650 but only up to 127 values of two bytes (16 bits) each.. 1652 5.3.1.1. Common Definitions 1654 The following definitions are used throughout RELOAD and so are 1655 defined here. They also provide a convenient introduction to how to 1656 read the presentation language. 1658 An enum represents an enumerated type. The values associated with 1659 each possibility are represented in parentheses and the maximum value 1660 is represented as a nameless value, for purposes of describing the 1661 width of the containing integral type. For instance, Boolean 1662 represents a true or false: 1664 enum { false (0), true(1), (255)} Boolean; 1666 A boolean value is either a 1 or a 0 and is represented as a single 1667 byte on the wire. 1669 The NodeId, shown below, represents a single Node-ID. 1671 typedef opaque NodeId[16]; 1673 A NodeId is a fixed-length 128-bit structure represented as a series 1674 of bytes, most significant byte first. Note: the use of "typedef" 1675 here is an extension to the TLS language, but its meaning should be 1676 relatively obvious. 1678 A ResourceId, shown below, represents a single Resource-ID. 1680 typedef opaque ResourceId<0..2^8-1>; 1682 Like a NodeId, a Resource-ID is an opaque string of bytes, but unlike 1683 Node-IDs, Resource-IDs are variable length, up to 255 bytes (2048 1684 bits) in length. On the wire, each ResourceId is preceded by a 1685 single length byte (allowing lengths up to 255). Thus, the 3-byte 1686 value "Foo" would be encoded as: 03 46 4f 4f. 1688 A more complicated example is IpAddressPort, which represents a 1689 network address and can be used to carry either an IPv6 or IPv4 1690 address: 1692 enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 1693 (255)} AddressType; 1695 struct { 1696 uint32 addr; 1697 uint16 port; 1698 } IPv4AddrPort; 1700 struct { 1701 uint128 addr; 1702 uint16 port; 1703 } IPv6AddrPort; 1705 struct { 1706 AddressType type; 1707 uint8 length; 1709 select (type) { 1710 case ipv4_address: 1711 IPv4AddrPort v4addr_port; 1713 case ipv6_address: 1714 IPv6AddrPort v6addr_port; 1716 /* This structure can be extended */ 1718 } IpAddressPort; 1720 The first two fields in the structure are the same no matter what 1721 kind of address is being represented: 1723 type: the type of address (v4 or v6). 1724 length: the length of the rest of the structure. 1726 By having the type and the length appear at the beginning of the 1727 structure regardless of the kind of address being represented, an 1728 implementation which does not understand new address type X can still 1729 parse the IpAddressPort field and then discard it if it is not 1730 needed. 1732 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1733 an IPv6AddrPort. Both of these simply consist of an address 1734 represented as an integer and a 16-bit port. As an example, here is 1735 the wire representation of the IPv4 address "192.0.2.1" with port 1736 "6100". 1738 01 ; type = IPv4 1739 06 ; length = 6 1740 c0 00 02 01 ; address = 192.0.2.1 1741 17 d4 ; port = 6100 1743 5.3.2. Forwarding Header 1745 The forwarding header is defined as a ForwardingHeader structure, as 1746 shown below. 1748 struct { 1749 uint32 relo_token; 1750 uint32 overlay; 1751 uint16 configuration_sequence; 1752 uint8 ttl; 1753 uint8 reserved; 1754 uint32 fragment; 1755 uint8 version; 1756 uint32 length; 1757 uint64 transaction_id; 1758 uint16 flags; 1760 uint16 via_list_length; 1761 uint16 destination_list_length; 1762 uint16 route_log_length; 1763 uint16 options_length; 1764 Destination via_list[via_list_length]; 1765 Destination destination_list 1766 [destination_list_length]; 1767 RouteLogEntry route_log[route_log_length]; 1768 ForwardingOptions options[options_length]; 1769 } ForwardingHeader; 1771 The contents of the structure are: 1773 relo_token: The first four bytes identify this message as a RELOAD 1774 message. The message is easy to demultiplex from STUN messages by 1775 looking at the first bit. This field MUST contain the value 1776 0xc2454c4f (the string 'RELO' with the high bit of the first byte 1777 set.). 1779 overlay: The 32 bit checksum/hash of the overlay being used. The 1780 variable length string representing the overlay name is hashed 1781 with SHA-1 and the low order 32 bits are used. The purpose of 1782 this field is to allow nodes to participate in multiple overlays 1783 and to detect accidental misconfiguration. This is not a security 1784 critical function. 1786 configuration_sequence: The sequence number of the configuration 1787 file. 1789 ttl: An 8 bit field indicating the number of iterations, or hops, a 1790 message can experience before it is discarded. The TTL value MUST 1791 be decremented by one at every hop along the route the message 1792 traverses. If the TTL is 0, the message MUST NOT be propagated 1793 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1794 should be generated. The initial value of the TTL SHOULD be 100 1795 unless defined otherwise by the overlay configuration. 1797 fragment: This field is used to handle fragmentation. The high 1798 order two bits are used to indicate the fragmentation status: If 1799 the high bit (0x80000000) is set, it indicates that the message is 1800 a fragment. If the next bit (0x40000000) is set, it indicates 1801 that this is the last fragment. 1802 The remainder of the field is used to indicate the fragment 1803 offset. [[Open Issue: This is conceptually clear, but the 1804 details are still lacking. Need to define the fragment offset and 1805 total length be encoded in the header. Right now we have 14 bits 1806 reserved with the intention that they be used for fragmenting, 1807 though additional bytes in the header might be needed for 1808 fragmentation.]] 1810 version: The version of the RELOAD protocol being used. This 1811 document describes version 0.1, with a value of 0x01. 1813 length: The count in bytes of the size of the message, including the 1814 header. 1816 transaction_id: A unique 64 bit number that identifies this 1817 transaction and also serves as a salt to randomize the request and 1818 the response. Responses use the same Transaction ID as the 1819 request they correspond to. Transaction IDs are also used for 1820 fragment reassembly. 1822 flags: The flags word contains control flags. Which are ORed 1823 together. There is two currently defined flags: ROUTE-LOG (0x1) 1824 and RESPONSE-ROUTE-LOG (0x2). These flags indicate that the route 1825 log should be included (see Section 5.3.2.3.). 1827 via_list_length: The length of the via list in bytes. Note that in 1828 this field and the following two length fields we depart from the 1829 usual variable-length convention of having the length immediately 1830 precede the value in order to make it easier for hardware decoding 1831 engines to quickly determine the length of the header. 1833 destination_list_length: The length of the destination list in 1834 bytes. 1836 route_log_length: The length of the route log in bytes. 1838 options_length: The length of the header options in bytes. 1840 via_list: The via_list contains the sequence of destinations through 1841 which the message has passed. The via_list starts out empty and 1842 grows as the message traverses each peer. 1844 destination_list: The destination_list contains a sequence of 1845 destinations which the message should pass through. The 1846 destination list is constructed by the message originator. The 1847 first element in the destination list is where the message goes 1848 next. The list shrinks as the message traverses each listed peer. 1850 route_log: Contains a series of route log entries. See 1851 Section 5.3.2.3. 1853 options: Contains a series of ForwardingOptions entries. See 1854 Section 5.3.2.4. 1856 5.3.2.1. Processing Configuration Sequence Numbers 1858 In order to be part of the overlay, a node MUST have a copy of the 1859 overlay configuration document. In order to allow for configuration 1860 document changes, each version of the configuration document has a 1861 sequence number which is monotonically increasing mod 65536. Because 1862 the sequence number may in principle wrap, greater than or less than 1863 are interpreted by modulo arithmetic as in TCP. 1865 When a destination node receives a request, it MUST check that the 1866 configuration_sequence field is equal to its own configuration 1867 sequence number. If they do not match, it MUST generate an error, 1868 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1869 the configuration file in the request is too old, it MUST generate a 1870 Config_Update message to update the requesting node. This allows new 1871 configuration documents to propagate quickly throughout the system. 1872 The one exception to this rule is that if the configuration_sequence 1873 field is equal to 0xffff, and the message type is Config_Update, then 1874 the message MUST be accepted regardless of the receiving node's 1875 configuration sequence number. 1877 5.3.2.2. Destination and Via Lists 1879 The destination list and via lists are sequences of Destination 1880 values: 1882 enum {reserved(0), peer(1), resource(2), compressed(3), (255) } 1883 DestinationType; 1885 select (destination_type) { 1886 case peer: 1887 NodeId node_id; 1889 case resource: 1890 ResourceId resource_id; 1892 case compressed: 1893 opaque compressed_id<0..2^8-1>; 1895 /* This structure may be extended with new types */ 1897 } DestinationData; 1899 struct { 1900 DestinationType type; 1901 uint8 length; 1902 DestinationData destination_data; 1903 } Destination; 1905 This is a TLV structure with the following contents: 1907 type 1908 The type of the DestinationData PDU. This may be one of "peer", 1909 "resource", or "compressed". 1911 length 1912 The length of the destination_data. 1914 destination_value 1915 The destination value itself, which is an encoded DestinationData 1916 structure, depending on the value of "type". 1918 Note: This structure encodes a type, length, value. The length 1919 field specifies the length of the DestinationData values, which 1920 allows the addition of new DestinationTypes. This allows an 1921 implementation which does not understand a given DestinationType 1922 to skip over it. 1924 A DestinationData can be one of three types: 1926 peer 1927 A Node-ID. 1929 compressed 1930 A compressed list of Node-IDs and/or resources. Because this 1931 value was compressed by one of the peers, it is only meaningful to 1932 that peer and cannot be decoded by other peers. Thus, it is 1933 represented as an opaque string. 1935 resource 1936 The Resource-ID of the resource which is desired. This type MUST 1937 only appear in the final location of a destination list and MUST 1938 NOT appear in a via list. It is meaningless to try to route 1939 through a resource. 1941 5.3.2.3. Route Logging 1943 The route logging feature provides diagnostic information about the 1944 path taken by the message so far and in this manner it is similar in 1945 function to SIP's [RFC3261] Via header field. If the ROUTE-LOG flag 1946 is set in the Flags word, at each hop peers MUST append a route log 1947 entry to the route log element in the header or reject the request. 1948 The order of the route log entry elements in the message is 1949 determined by the order of the peers were traversed along the path. 1950 The first route log entry corresponds to the peer at the first hop 1951 along the path, and each subsequent entry corresponds to the peer at 1952 the next hop along the path. If the ROUTE-LOG flag is set, the route 1953 log entries in the request MUST be copied to the response or the 1954 request rejected. If, and only if, the ROUTE-LOG-RESPONSE flag is 1955 set in a request, the ROUTE-LOG flag MUST be set in the response. 1957 Note that use of the ROUTE-LOG-RESPONSE flag means that the response 1958 will grow on the return path, which may potentially mean that it gets 1959 dropped due to becoming too large for some intermediate hop. Thus, 1960 this option must be used with care. 1962 The route log is defined as follows: 1964 enum { (255) } RouteLogExtensionType; 1966 struct { 1967 RouteLogExtensionType type; 1968 uint16 length; 1970 select (type){ 1971 /* Extension values go here */ 1972 } extension; 1973 } RouteLogExtension; 1975 enum { 1976 reserved(0), 1977 tcp_tls(1), 1978 udp_dtls(2), 1979 (255) 1980 } OverlayLink; 1982 struct { 1983 opaque version<0..2^8-1>; /* A string */ 1984 OverlayLink linkProtocol; /* TCP or UDP */ 1985 NodeId id; 1986 uint32 uptime; 1987 IpAddressPort address; 1988 opaque certificate<0..2^16-1>; 1989 RouteLogExtension extensions<0..2^16-1>; 1990 } RouteLogEntry; 1992 struct { 1993 RouteLogEntry entries<0..2^16-1>; 1994 } RouteLog; 1996 The route log consists of an arbitrary number of RouteLogEntry 1997 values, each representing one node through which the message has 1998 passed. 2000 Each RouteLogEntry consists of the following values: 2002 version 2003 A textual representation of the software version 2005 linkProtocol 2006 The Overlay Link Layer protocol, currently either "tcp_tls" or 2007 "udp_dtls". 2009 id 2010 The Node-ID of the peer. 2012 uptime 2013 The uptime of the peer in seconds. 2015 address 2016 The address and port of the peer. 2018 certificate 2019 The peer's certificate. Note that this may be omitted by setting 2020 the length to zero. 2022 extensions 2023 Extensions, if any. 2025 Extensions are defined using a RouteLogExtension structure. New 2026 extensions are defined by defining a new code point for 2027 RouteLogExtensionType and adding a new arm to the RouteLogExtension 2028 structure. The contents of that structure are: 2030 type 2031 The type of the extension. 2033 length 2034 The length of the rest of the structure. 2036 extension 2037 The extension value. 2039 5.3.2.4. Forwarding Options 2041 The Forwarding header can be extended with forwarding header options, 2042 which are a series of ForwardingOptions structures: 2044 enum { (255) } ForwardingOptionsType; 2046 struct { 2047 ForwardingOptionsType type; 2048 uint8 flags; 2049 uint16 length; 2050 select (type) { 2051 /* Option values go here */ 2052 } option; 2053 } ForwardingOption; 2055 Each ForwardingOption consists of the following values: 2057 type 2058 The type of the option. 2060 length 2061 The length of the rest of the structure. 2063 flags 2064 Three flags are defined FORWARD_CRITICAL(0x01), 2065 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2066 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2067 set, any node that would forward the message but does not 2068 understand this options MUST reject the request with an 757 error 2069 response. If the DESTINATION_CRITICAL flag is set, any node 2070 generates a response to the message but does not understand the 2071 forwarding option MUST reject the request with an 757 error 2072 response. If the RESPONSE_COPY flag is set, any node generating a 2073 response MUST copy the option from the request to the response and 2074 clear the RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL 2075 flags. 2077 option 2078 The option value. 2080 5.3.3. Message Contents Format 2082 The second major part of a RELOAD message is the contents part, which 2083 is defined by MessageContents: 2085 struct { 2086 MessageCode message_code; 2087 opaque payload<0..2^24-1>; 2088 } MessageContents; 2090 The contents of this structure are as follows: 2092 message_code 2093 This indicates the message that is being sent. The code space is 2094 broken up as follows. 2096 0 Reserved 2098 1 .. 0x7fff Requests and responses. These code points are always 2099 paired, with requests being odd and the corresponding response 2100 being the request code plus 1. Thus, "probe_request" (the 2101 Probe request) has value 1 and "probe_answer" (the Probe 2102 response) has value 2 2104 0xffff Error 2106 message_body 2107 The message body itself, represented as a variable-length string 2108 of bytes. The bytes themselves are dependent on the code value. 2109 See the sections describing the various RELOAD methods (Join, 2110 Update, Attach, Store, Fetch, etc.) for the definitions of the 2111 payload contents. 2113 5.3.3.1. Response Codes and Response Errors 2115 A peer processing a request returns its status in the message_code 2116 field. If the request was a success, then the message code is the 2117 response code that matches the request (i.e., the next code up). The 2118 response payload is then as defined in the request/response 2119 descriptions. 2121 If the request failed, then the message code is set to 0xffff (error) 2122 and the payload MUST be an error_response PDU, as shown below. 2124 When the message code is 0xffff, the payload MUST be an 2125 ErrorResponse. 2127 public struct { 2128 uint16 error_code; 2129 opaque error_info<0..2^16-1>; 2130 } ErrorResponse; 2132 The contents of this structure are as follows: 2134 error_code 2135 A numeric error code indicating the error that occurred. 2137 error_info 2138 An arbitrary byte string. Unless otherwise specified, this will 2139 be a text string providing further information about what went 2140 wrong. 2142 The following error code values are defined. The numeric values for 2143 these are defined in Section 13.7. 2145 Error_Unauthorized: The requesting peer needs to sign and provide a 2146 certificate. [[TODO: The semantics here don't seem quite 2147 right.]] 2149 Error_Forbidden: The requesting peer does not have permission to 2150 make this request. 2152 Error_Not_Found: The resource or peer cannot be found or does not 2153 exist. 2155 Error_Request_Timeout: A response to the request has not been 2156 received in a suitable amount of time. The requesting peer MAY 2157 resend the request at a later time. 2159 Error_Precondition_Failed: A request can't be completed because some 2160 precondition was incorrect. For instance, the wrong generation 2161 counter was provided 2163 Error_Incompatible_with_Overlay: A peer receiving the request is 2164 using a different overlay, overlay algorithm, or hash algorithm. 2166 Error_Unsupported_Forwarding_Option: A peer receiving the request 2167 with a forwarding options flagged as critical but the peer does 2168 not support this option. See section Section 5.3.2.4. 2170 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2171 decremented to zero. See section Section 5.3.2. 2173 Error_Message_Too_Large: A peer receiving the request that was too 2174 large. See section Section 5.6. 2175 Error_Config_Too_Old: A destination peer received a request with a 2176 configuration sequence that's too old. 2178 Error_Config_Too_New: A destination node received a request with a 2179 configuration sequence that's too new. A node which receives this 2180 error MUST generate a Config_Update message to send a new copy of 2181 the configuration document to the node which generated the error. 2183 5.3.4. Security Block 2185 The third part of a RELOAD message is the security block. The 2186 security block is represented by a SecurityBlock structure: 2188 enum { x509(0), (255) } certificate_type; 2190 struct { 2191 certificate_type type; 2192 opaque certificate<0..2^16-1>; 2193 } GenericCertificate; 2195 struct { 2196 GenericCertificate certificates<0..2^16-1>; 2197 Signature signature; 2198 } SecurityBlock; 2200 The contents of this structure are: 2202 certificates 2203 A bucket of certificates. 2205 signature 2206 A signature over the message contents. 2208 The certificates bucket SHOULD contain all certificates necessary to 2209 verify every signature in both the message and the internal message 2210 objects. This is the only location in the message which contains 2211 certificates, thus allowing for only a single copy of each 2212 certificate. In systems which have some alternate certificate 2213 distribution mechanism, some certificates MAY be omitted. However, 2214 implementors should note that this creates the possibility that 2215 messages may not be immediately verifiable upon receipt of the 2216 certificates must first be retrieved. 2218 Each certificate is represented by a GenericCertificate structure, 2219 which has the following contents: 2221 type 2222 The type of the certificate. Only one type is defined: x509 2223 representing an X.509 certificate 2225 certificate 2226 The encoded version of the certificate. For X.509 certificates, 2227 it is the DER form. 2229 The signature is computed over the payload and parts of forwarding 2230 header. The payload, in case of a Store, may contain an additional 2231 signature computed over a StoreReq structure. All signatures are 2232 formatted using the Signature element. This element is also used in 2233 other contexts where signatures are needed. The input structure to 2234 the signature computation varies depending on the data element being 2235 signed. 2237 enum {reserved(0), cert_hash(1), (255)} SignerIdentityType; 2239 select (identity_type) { 2240 case cert_hash; 2241 HashAlgorithm hash_alg; 2242 opaque certificate_hash<0..2^8-1>; 2243 /* This structure may be extended with new types if necessary*/ 2244 } SignerIdentityValue; 2246 struct { 2247 SignerIdentityType identity_type; 2248 uint16 length; 2249 SignerIdentityValue identity[SignerIdentity.length]; 2250 } SignerIdentity; 2252 struct { 2253 SignatureAndHashAlgorithm algorithm; 2254 SignerIdentity identity; 2255 opaque signature_value<0..2^16-1>; 2256 } Signature; 2258 The signature construct contains the following values: 2260 algorithm 2261 The signature algorithm in use. The algorithm definitions are 2262 found in the IANA TLS SignatureAlgorithm Registry. 2264 identity 2265 The identity used to form the signature 2267 signature_value 2268 The value of the signature 2270 The only currently permitted identity format is a hash of the 2271 signer's certificate. The hash_alg field is used to indicate the 2272 algorithm used to produce the hash. The certificate_hash contains 2273 the hash of the certificate object as represented in the certificates 2274 structure. The SignerIdentity structure is typed purely to allow for 2275 future (unanticipated) extensibility. [TODO: Should we remove this 2276 extensibility point?] 2278 For signatures over messages the input to the signature is computed 2279 over: 2281 overlay + transaction_id + MessageContents + SignerIdentity 2283 Where overlay and transaction_id come from the forwarding header and 2284 + indicates concatenation. 2286 [[TODO: Check the inputs to this carefully.]] 2288 The input to signatures over data values is different, and is 2289 described in Section 6.1. 2291 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2292 MUST verify the signature and the authorizing certificate. This 2293 check provides a minimal level of assurance that the sending node is 2294 a valid part of the overlay as well as cryptographic authentication 2295 of the sending node. In addition, responses MUST be checked as 2296 follows: 2298 1. The response to a message sent to a specific Node-Id MUST have 2299 been sent by that Node-Id. 2300 2. The response to a message sent to a Resource-Id MUST have been 2301 sent by a Node-Id which is as close to or closer to the target 2302 Resource-Id than any node in the requesting node's neighbor 2303 table. 2305 The second condition serves as a primitive check for responses from 2306 wildly wrong nodes but is not a complete check. Note that in periods 2307 of churn, it is possible for the requesting node to obtain a closer 2308 neighbor while the request is outstanding. This will cause the 2309 response to be rejected and the request to be retransmitted. 2311 In addition, some methods (especially Store) have additional 2312 authentication requirements, which are described in the sections 2313 covering those methods. 2315 5.4. Overlay Topology 2317 As discussed in previous sections, RELOAD does not itself implement 2318 any overlay topology. Rather, it relies on Topology Plugins, which 2319 allow a variety of overlay algorithms to be used while maintaining 2320 the same RELOAD core. This section describes the requirements for 2321 new topology plugins and the methods that RELOAD provides for overlay 2322 topology maintenance. 2324 5.4.1. Topology Plugin Requirements 2326 When specifying a new overlay algorithm, at least the following need 2327 to be described: 2329 o Joining procedures, including the contents of the Join message. 2330 o Stabilization procedures, including the contents of the Update 2331 message, the frequency of topology probes and keepalives, and the 2332 mechanism used to detect when peers have disconnected. 2333 o Exit procedures, including the contents of the Leave message. 2334 o The length of the Resource-IDs and Node-IDs. For DHTs, the hash 2335 algorithm to compute the hash of an identifier. 2336 o The procedures that peers use to route messages. 2337 o The replication strategy used to ensure data redundancy. 2339 5.4.2. Methods and types for use by topology plugins 2341 This section describes the methods that topology plugins use to join, 2342 leave, and maintain the overlay. 2344 5.4.2.1. Join 2346 A new peer (but which already has credentials) uses the JoinReq 2347 message to join the overlay. The JoinReq is sent to the responsible 2348 peer depending on the routing mechanism described in the topology 2349 plugin. This notifies the responsible peer that the new peer is 2350 taking over some of the overlay and it needs to synchronize its 2351 state. 2353 struct { 2354 NodeId joining_peer_id; 2355 opaque overlay_specific_data<0..2^16-1>; 2356 } JoinReq; 2358 The minimal JoinReq contains only the Node-ID which the sending peer 2359 wishes to assume. Overlay algorithms MAY specify other data to 2360 appear in this request. 2362 If the request succeeds, the responding peer responds with a JoinAns 2363 message, as defined below: 2365 struct { 2366 opaque overlay_specific_data<0..2^16-1>; 2367 } JoinAns; 2369 If the request succeeds, the responding peer MUST follow up by 2370 executing the right sequence of Stores and Updates to transfer the 2371 appropriate section of the overlay space to the joining peer. In 2372 addition, overlay algorithms MAY define data to appear in the 2373 response payload that provides additional info. 2375 In general, nodes which cannot form connections SHOULD report an 2376 error. However, implementations MUST provide some mechanism whereby 2377 nodes can determine they are potentially the first node and take 2378 responsibility for the overlay. This specification does not mandate 2379 any particular mechanism, but a configuration flag or setting seems 2380 appropriate. 2382 5.4.2.2. Leave 2384 The LeaveReq message is used to indicate that a node is exiting the 2385 overlay. A node SHOULD send this message to each peer with which it 2386 is directly connected prior to exiting the overlay. 2388 public struct { 2389 NodeId leaving_peer_id; 2390 opaque overlay_specific_data<0..2^16-1>; 2391 } LeaveReq; 2393 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2394 algorithms MAY specify other data to appear in this request. 2396 Upon receiving a Leave request, a peer MUST update its own routing 2397 table, and send the appropriate Store/Update sequences to re- 2398 stabilize the overlay. 2400 5.4.2.3. Update 2402 Update is the primary overlay-specific maintenance message. It is 2403 used by the sender to notify the recipient of the sender's view of 2404 the current state of the overlay (its routing state) and it is up to 2405 the recipient to take whatever actions are appropriate to deal with 2406 the state change. 2408 The contents of the UpdateReq message are completely overlay- 2409 specific. The UpdateAns response is expected to be either success or 2410 an error. 2412 5.4.2.4. Route_Query 2414 The Route_Query request allows the sender to ask a peer where they 2415 would route a message directed to a given destination. In other 2416 words, a RouteQuery for a destination X requests the Node-ID where 2417 the receiving peer would next route to get to X. A RouteQuery can 2418 also request that the receiving peer initiate an Update request to 2419 transfer his routing table. 2421 One important use of the RouteQuery request is to support iterative 2422 routing. The sender selects one of the peers in its routing table 2423 and sends it a RouteQuery message with the destination_object set to 2424 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2425 responds with information about the peers to which the request would 2426 be routed. The sending peer MAY then Attaches to that peer(s), and 2427 repeats the RouteQuery. Eventually, the sender gets a response from 2428 a peer that is closest to the identifier in the destination_object as 2429 determined by the topology plugin. At that point, the sender can 2430 send messages directly to that peer. 2432 5.4.2.4.1. Request Definition 2434 A RouteQueryReq message indicates the peer or resource that the 2435 requesting peer is interested in. It also contains a "send_update" 2436 option allowing the requesting peer to request a full copy of the 2437 other peer's routing table. 2439 struct { 2440 Boolean send_update; 2441 Destination destination; 2442 opaque overlay_specific_data<0..2^16-1>; 2443 } RouteQueryReq; 2445 The contents of the RouteQueryReq message are as follows: 2447 send_update 2448 A single byte. This may be set to "true" to indicate that the 2449 requester wishes the responder to initiate an Update request 2450 immediately. Otherwise, this value MUST be set to "false". 2452 destination 2453 The destination which the requester is interested in. This may be 2454 any valid destination object, including a Node-ID, compressed ids, 2455 or Resource-ID. 2457 overlay_specific_data 2458 Other data as appropriate for the overlay. 2460 5.4.2.4.2. Response Definition 2462 A response to a successful RouteQueryReq request is a RouteQueryAns 2463 message. This is completely overlay specific. 2465 5.4.2.5. Probe 2467 Probe provides a number of primitive "exploration" services: (1) it 2468 allows node to determine which resources another node is responsible 2469 for (2) it allows some discovery services in multicast settings. A 2470 probe can be addressed to a specific Node-ID, or the peer controlling 2471 a given location (by using a resource ID). In either case, the 2472 target Node-IDs respond with a simple response containing some status 2473 information. 2475 5.4.2.5.1. Request Definition 2477 The ProbeReq message contains a list (potentially empty) of the 2478 pieces of status information that the requester would like the 2479 responder to provide. 2481 enum { responsible_set(1), num_resources(2), (255)} 2482 ProbeInformationType; 2484 struct { 2485 ProbeInformationType requested_info<0..2^8-1>; 2486 } ProbeReq 2488 The two currently defined values for ProbeInformation are: 2490 responsible_set 2491 indicates that the peer should Respond with the fraction of the 2492 overlay for which the responding peer is responsible. 2494 num_resources 2495 indicates that the peer should Respond with the number of 2496 resources currently being stored by the peer. 2498 5.4.2.5.2. Response Definition 2500 A successful ProbeAns response contains the information elements 2501 requested by the peer. 2503 struct { 2504 ProbeInformationType type; 2506 select (type) { 2507 case responsible_set: 2508 uint32 responsible_ppb; 2510 case num_resources: 2511 uint32 num_resources; 2513 /* This type may be extended */ 2515 }; 2516 } ProbeInformation; 2518 struct { 2519 ProbeInformation probe_info<0..2^16-1>; 2520 } ProbeAns; 2522 A ProbeAns message contains the following elements: 2524 probe_info 2525 A sequence of ProbeInformation structures, as shown below. 2527 Each of the current possible Probe information types is a 32-bit 2528 unsigned integer. For type "responsible_ppb", it is the fraction of 2529 the overlay for which the peer is responsible in parts per billion. 2530 For type "num_resources", it is the number of resources the peer is 2531 storing. 2533 The responding peer SHOULD include any values that the requesting 2534 peer requested and that it recognizes. They SHOULD be returned in 2535 the requested order. Any other values MUST NOT be returned. 2537 5.5. Forwarding and Link Management Layer 2539 Each node maintains connections to a set of other nodes defined by 2540 the topology plugin. This section defines the methods RELOAD uses to 2541 form and maintain connections between nodes in the overlay. Three 2542 methods are defined: 2544 Attach: used to form connections between nodes. When node A wants 2545 to connect to node B, it sends an Attach message to node B through 2546 the overlay. The Attach contains A's ICE parameters. B responds 2547 with its ICE parameters and the two nodes perform ICE to form 2548 connection. 2549 AttachLite: like attach, it is used to form connections between 2550 nodes but instead of using full ICE, it only uses a subset known 2551 as ICE-Lite. 2552 Ping: is a simple request/response which is used to verify 2553 connectivity of the target peer. 2555 5.5.1. Attach 2557 A node sends an Attach request when it wishes to establish a direct 2558 TCP or UDP connection to another node for the purposes of sending 2559 RELOAD messages or application layer protocol messages, such as SIP. 2561 As described in Section 5.1, an Attach may be routed to either a 2562 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2563 will fail if that node is not reached. An Attach routed to a 2564 Resource-ID will establish a connection with the peer currently 2565 responsible for that Resource-ID, which may be useful in establishing 2566 a direct connection to the responsible peer for use with frequent or 2567 large resource updates. 2569 An Attach in and of itself does not result in updating the routing 2570 table of either node. That function is performed by Updates. If 2571 node A has Attached to node B, but not received any Updates from B, 2572 it MAY route messages which are directly addressed to B through that 2573 channel but MUST NOT route messages through B to other peers via that 2574 channel. The process of Attaching is separate from the process of 2575 becoming a peer (using Update) to prevent half-open states where a 2576 node has started to form connections but is not really ready to act 2577 as a peer. 2579 5.5.1.1. Request Definition 2581 An AttachReq message contains the requesting peer's ICE connection 2582 parameters formatted into a binary structure. 2584 typedef opaque IceCandidate<0..2^16-1>; 2586 struct { 2587 opaque ufrag<0..2^8-1>; 2588 opaque password<0..2^8-1>; 2589 uint16 application; 2590 opaque role<0..2^8-1>; 2591 IceCandidate candidates<0..2^16-1>; 2592 } AttachReqAns; 2594 The values contained in AttachReq and AttachAns are: 2596 ufrag 2597 The username fragment (from ICE) 2599 password 2600 The ICE password. 2602 application 2603 A 16-bit port number. This port number represents the IANA 2604 registered port of the protocol that is going to be sent on this 2605 connection. For SIP, this is 5060 or 5061, and for RELOAD is TBD. 2606 By using the IANA registered port, we avoid the need for an 2607 additional registry and allow RELOAD to be used to set up 2608 connections for any existing or future application protocol. 2610 role 2611 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 2613 candidates 2614 One or more ICE candidate values in the string representation used 2615 in ordinary ICE. [[OPEN ISSUE: This is convenient for stacks, 2616 but unaesthetic.]] Each candidate has an IP address, IP address 2617 family, port, transport protocol, priority, foundation, component 2618 ID, STUN type and related address. The candidate_list is a list 2619 of string candidate values from ICE. 2621 These values should be generated using the procedures described in 2622 Section 5.5.1.3. 2624 5.5.1.2. Response Definition 2626 If a peer receives an Attach request, it SHOULD follow the process 2627 the request and generate its own response with a AttachReqAns. It 2628 should then begin ICE checks. When a peer receives an Attach 2629 response, it SHOULD parse the response and begin its own ICE checks. 2631 5.5.1.3. Using ICE With RELOAD 2633 This section describes the profile of ICE that is used with RELOAD. 2634 RELOAD implementations MUST implement full ICE. Because RELOAD 2635 always tries to use TCP and then UDP as a fallback, there will be 2636 multiple candidates of the same IP version, which requires full ICE. 2638 In ICE as defined by [I-D.ietf-mmusic-ice], SDP is used to carry the 2639 ICE parameters. In RELOAD, this function is performed by a binary 2640 encoding in the Attach method. This encoding is more restricted than 2641 the SDP encoding because the RELOAD environment is simpler: 2643 o Only a single media stream is supported. 2644 o In this case, the "stream" refers not to RTP or other types of 2645 media, but rather to a connection for RELOAD itself or for SIP 2646 signaling. 2647 o RELOAD only allows for a single offer/answer exchange. Unlike the 2648 usage of ICE within SIP, there is never a need to send a 2649 subsequent offer to update the default candidates to match the 2650 ones selected by ICE. 2652 An agent follows the ICE specification as described in 2653 [I-D.ietf-mmusic-ice] and [I-D.ietf-mmusic-ice-tcp] with the changes 2654 and additional procedures described in the subsections below. 2656 5.5.1.4. Collecting STUN Servers 2658 ICE relies on the node having one or more STUN servers to use. In 2659 conventional ICE, it is assumed that nodes are configured with one or 2660 more STUN servers through some out-of-band mechanism. This is still 2661 possible in RELOAD but RELOAD also learns STUN servers as it connects 2662 to other peers. Because all RELOAD peers implement ICE and use STUN 2663 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2664 peer a node knows will be willing to be a STUN server -- though of 2665 course it may be behind a NAT. 2667 A peer on a well-provisioned wide-area overlay will be configured 2668 with one or more bootstrap peers. These peers make an initial list 2669 of STUN servers. However, as the peer forms connections with 2670 additional peers, it builds more peers it can use as STUN servers. 2672 Because complicated NAT topologies are possible, a peer may need more 2673 than one STUN server. Specifically, a peer that is behind a single 2674 NAT will typically observe only two IP addresses in its STUN checks: 2675 its local address and its server reflexive address from a STUN server 2676 outside its NAT. However, if there are more NATs involved, it may 2677 discover that it learns additional server reflexive addresses (which 2678 vary based on where in the topology the STUN server is). To maximize 2679 the chance of achieving a direct connection, a peer SHOULD group 2680 other peers by the peer-reflexive addresses it discovers through 2681 them. It SHOULD then select one peer from each group to use as a 2682 STUN server for future connections. 2684 Only peers to which the peer currently has connections may be used. 2685 If the connection to that host is lost, it MUST be removed from the 2686 list of stun servers and a new server from the same group SHOULD be 2687 selected. 2689 5.5.1.5. Gathering Candidates 2691 When a node wishes to establish a connection for the purposes of 2692 RELOAD signaling or SIP signaling (or any other application protocol 2693 for that matter), it follows the process of gathering candidates as 2694 described in Section 4 of ICE [I-D.ietf-mmusic-ice]. RELOAD utilizes 2695 a single component, as does SIP. Consequently, gathering for these 2696 "streams" requires a single component. 2698 An agent MUST implement ICE-tcp [I-D.ietf-mmusic-ice], and MUST 2699 gather at least one UDP and one TCP host candidate for RELOAD and for 2700 SIP. 2702 The ICE specification assumes that an ICE agent is configured with, 2703 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2704 for an agent to learn these by querying the overlay, as described in 2705 Section 5.5.1.4 and Section 8. 2707 The agent SHOULD prioritize its TCP-based candidates over its UDP- 2708 based candidates in the prioritization described in Section 4.1.2 of 2709 ICE [I-D.ietf-mmusic-ice]. 2711 The default candidate selection described in Section 4.1.3 of ICE is 2712 ignored; defaults are not signaled or utilized by RELOAD. 2714 5.5.1.6. Encoding the Attach Message 2716 Section 4.3 of ICE describes procedures for encoding the SDP for 2717 conveying RELOAD or SIP ICE candidates. Instead of actually encoding 2718 an SDP, the candidate information (IP address and port and transport 2719 protocol, priority, foundation, component ID, type and related 2720 address) is carried within the attributes of the Attach request or 2721 its response. Similarly, the username fragment and password are 2722 carried in the Attach message or its response. Section 5.5.1 2723 describes the detailed attribute encoding for Attach. The Attach 2724 request and its response do not contain any default candidates or the 2725 ice-lite attribute, as these features of ICE are not used by RELOAD. 2726 The Attach request and its response also contain a application 2727 attribute, with a value of SIP or RELOAD, which indicates what 2728 protocol is to be run over the connection. The RELOAD Attach request 2729 MUST only be utilized to set up connections for application protocols 2730 that can be multiplexed with STUN. 2732 Since the Attach request contains the candidate information and short 2733 term credentials, it is considered as an offer for a single media 2734 stream that happens to be encoded in a format different than SDP, but 2735 is otherwise considered a valid offer for the purposes of following 2736 the ICE specification. Similarly, the Attach response is considered 2737 a valid answer for the purposes of following the ICE specification. 2739 5.5.1.7. Verifying ICE Support 2741 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2742 of ICE. Since RELOAD requires full ICE from all agents, this check 2743 is not required. 2745 5.5.1.8. Role Determination 2747 The roles of controlling and controlled as described in Section 5.2 2748 of ICE are still utilized with RELOAD. However, the offerer (the 2749 entity sending the Attach request) will always be controlling, and 2750 the answerer (the entity sending the Attach response) will always be 2751 controlled. The connectivity checks MUST still contain the ICE- 2752 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2753 role reversal capability for which they are defined will never be 2754 needed with RELOAD. This is to allow for a common codebase between 2755 ICE for RELOAD and ICE for SDP. 2757 5.5.1.9. Connectivity Checks 2759 The processes of forming check lists in Section 5.7 of ICE, 2760 scheduling checks in Section 5.8, and checking connectivity checks in 2761 Section 7 are used with RELOAD without change. 2763 5.5.1.10. Concluding ICE 2765 The controlling agent MUST utilize regular nomination. This is to 2766 ensure consistent state on the final selected pairs without the need 2767 for an updated offer, as RELOAD does not generate additional offer/ 2768 answer exchanges. 2770 The procedures in Section 8 of ICE are followed to conclude ICE, with 2771 the following exceptions: 2773 o The controlling agent MUST NOT attempt to send an updated offer 2774 once the state of its single media stream reaches Completed. 2775 o Once the state of ICE reaches Completed, the agent can immediately 2776 free all unused candidates. This is because RELOAD does not have 2777 the concept of forking, and thus the three second delay in Section 2778 8.3 of ICE does not apply. 2780 5.5.1.11. Subsequent Offers and Answers 2782 An agent MUST NOT send a subsequent offer or answer. Thus, the 2783 procedures in Section 9 of ICE MUST be ignored. 2785 5.5.1.12. Media Keepalives 2787 STUN MUST be utilized for the keepalives described in Section 10 of 2788 ICE. [[ TODO - this does not define what happens for TCP ]] 2790 5.5.1.13. Sending Media 2792 The procedures of Section 11 apply to RELOAD as well. However, in 2793 this case, the "media" takes the form of application layer protocols 2794 (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE 2795 processing completes, the agent will begin TLS or DTLS procedures to 2796 establish a secure connection. The node which sent the Attach 2797 request MUST be the TLS server. The other node MUST be the TLS 2798 client. The nodes MUST verify that the certificate presented in the 2799 handshake matches the identity of the other peer as found in the 2800 Attach message. Once the TLS or DTLS signaling is complete, the 2801 application protocol is free to use the connection. 2803 The concept of a previous selected pair for a component does not 2804 apply to RELOAD, since ICE restarts are not possible with RELOAD. 2806 5.5.1.14. Receiving Media 2808 An agent MUST be prepared to receive packets for the application 2809 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 2810 time. The jitter and RTP considerations in Section 11 of ICE do not 2811 apply to RELOAD or SIP. 2813 5.5.2. AttachLite 2815 An alternative to using the full ICE supported by the Attach request 2816 is to use ICE-Lite with the AttachLite request. This will not work 2817 in all of the scenarios where ICE would work, but in some cases, 2818 particularly those with no NATs or firewalls, it will work. 2819 Configuration for the overlay indicates if this can be used or not. 2821 OPEN ISSUE: We originally envisioned adding support for ICE-Lite 2822 directly to the regular Attach method. However, we found that both 2823 the parameters and processing were completely different, resulting in 2824 almost no overlap between the two methods. Therefore we chose to 2825 separate this out for overlays where the complexities of ICE are not 2826 needed. Note that it is still possible for a node with a public 2827 unfiltered address intending to interoperate to implement Attach 2828 without the candidate gathering phases of ICE and achieve essentially 2829 the same result. If simpler behavior or a better encoding of ICE- 2830 Lite in Attach is developed, such an approach would be preferable. 2832 5.5.2.1. Request Definition 2834 An AttachLiteReq message contains the requesting peer's ICE-Lite 2835 connection parameters formatted into a binary structure. When using 2836 the AttachLite request, both sides act as ICE-Lite hosts. 2838 struct { 2839 IpAddressPort addr_port; 2840 Transport transport; 2841 uint32 priority; 2842 } IceLiteCandidate; 2844 struct { 2845 uint16 application; 2846 IceLiteCandidate candidates<0..2^16-1>; 2847 } AttachLiteReqs; 2849 The values contained in AttachLiteReq are: 2851 application 2852 A 16-bit port number used in the same was as in the Attach 2853 request. This port number represents the IANA registered port of 2854 the protocol that is going to be sent on this connection. 2856 candidates 2857 One or more ICE candidate values. Each one contains an IP address 2858 and family, transport protocol, and port to connect to as well as 2859 a priority. 2861 These values should be generated using the procedures described in 2862 Section 5.5.1.3. 2864 5.5.2.2. Attach-Lite Connectivity Checks 2866 STUN is not used for connectivity checks when doing ICE-Lite, instead 2867 the DTLS or TLS handshake forms the connectivity check. The host 2868 that received the AttachLiteReq MUST initiate TLS or DTLS connections 2869 to candidates provided in the request. When a connection forms, the 2870 node MUST check the certificate is for the node that send 2871 AttachLiteReq and if is not, MUST close the connection. 2873 Since TLS provides the connectivity check, there is no need for the 2874 RFC 4571 [RFC4571] style framing shim for STUN when using TLS and 2875 this is not used for this protocol. 2877 5.5.2.3. Implementation Notes for Attach-Lite 2879 This is a non normative section to help implementors. 2881 At times ICE can seem a bit daunting to gets one head around. For a 2882 simple IPv4 only peer, a simple implementation of Attach-Lite could 2883 be done be doing the following: 2884 o When sending an AttachLiteReq, form one with a candidate with a 2885 priority value of (2^24)*(126)+(2^8)*(65535)+(2^0)*(256-1) that 2886 specifies the UDP port being listened to and another one with the 2887 TCP port. 2888 o When receiving an AttachLiteReq, try to form a connection to each 2889 candidate in the request. Check the certificate receive in the 2890 TLS handshake has the correct Node-ID as the node that send the 2891 AttchLiteReq. If multiple connection succeed, close all but the 2892 one with highest priority. 2893 o Do normal TLS and DTLS with no need for any special framing or 2894 STUN processing. 2896 5.5.3. Ping 2898 Ping is used to test connectivity along a path. A ping can be 2899 addressed to a specific Node-ID, the peer controlling a given 2900 location (by using a resource ID), or to the broadcast Node-ID (all 2901 1s). 2903 5.5.3.1. Request Definition 2905 struct { 2906 } PingReq 2908 5.5.3.2. Response Definition 2910 A successful PingAns response contains the information elements 2911 requested by the peer. 2913 struct { 2914 uint64 response_id; 2915 uint64 time; 2916 } PingAns; 2918 A PingAns message contains the following elements: 2920 response_id 2921 A randomly generated 64-bit response ID. This is used to 2922 distinguish Ping responses in cases where the Ping request is 2923 multicast. 2924 time 2925 The time when the ping responses was created in absolute time, 2926 represented in milliseconds since midnight Jan 1, 1970 which is 2927 the UNIX epoch. 2929 5.5.4. Config_Update 2931 The Config_Update method is used to propagate updated configuration 2932 files across the overlay. Whenever a node detects that another node 2933 has an old configuration file, it MUST generate a Config_Update 2934 request. 2936 5.5.4.1. Request Definition 2938 struct { 2939 opaque config_data<2^24-1>; 2940 } Config_UpdateReq; 2942 The Config_UpdateReq message contains the following elements: 2944 config_data 2945 The contents of the configuration document. 2947 5.5.4.2. Response Definition 2949 struct { 2950 } Config_UpdateReq 2952 The Config_UpdateReq should only be processed if all the following 2953 are true: 2954 o The configuration sequence number in the document is greater than 2955 the current configuration sequence number. 2956 o The configuration document is correctly digitally signed (see 2957 Section 10 for details on signatures. 2958 Otherwise appropriate errors MUST be generated. 2960 If the document is acceptable, then the node MUST reconfigure itself 2961 to match the new document. This may include adding permissions for 2962 new kinds, deleting old kinds, or even, in extreme circumstances, 2963 exiting and reentering the overlay, if, for instance, the DHT 2964 algorithm has changed. 2966 The response for Config_Update is empty. 2968 5.6. Overlay Link Layer 2970 RELOAD can use multiple Overlay Link protocols to send its messages. 2971 Because ICE is used to establish connections (see Section 5.5.1.3), 2972 RELOAD nodes are able to detect which Overlay Link protocols are 2973 offered by other nodes and establish connections between each other. 2974 Any link protocol needs to be able to establish a secure, 2975 authenticated connection, and provide data origin authentication and 2976 message integrity for individual data elements. RELOAD currently 2977 supports two Overlay Link protocols: 2979 o TLS [RFC5246] over TCP 2980 o DTLS [RFC4347] over UDP 2982 Note that although UDP does not properly have "connections", both TLS 2983 and DTLS have a handshake which establishes a stateful association, a 2984 similar stateful construct, and we simply refer to these as 2985 "connections" for the purposes of this document. 2987 If a peer receives a message that is larger than value of max- 2988 message-size defined in the overlay configuration, the peer SHOULD 2989 send an Error_Message_Too_Large error then close the TLS or DTLS 2990 session from which the message was received. Note that this error 2991 can be sent and the session closed before receiving the complete 2992 message. If the forwarding header is larger than the max-message- 2993 size, the receiver SHOULD close the TLS or DTLS session without 2994 sending an error. 2996 5.6.1. Future Support for HIP 2998 The P2PSIP Working Group has expressed interest in supporting a HIP- 2999 based link protocol. Such support would require specifying such 3000 details as: 3002 o How to issue certificates which provided identities meaningful to 3003 the HIP base exchange. We anticipate that this would require a 3004 mapping between ORCHIDs and NodeIds. 3005 o How to carry the HIP I1 and I2 messages. We anticipate that this 3006 would require defining a HIP Tunnel usage. 3007 o How to carry RELOAD messages over HIP. 3009 We leave this work as a topic for another draft. 3011 5.6.2. Reliability for Unreliable Links 3013 When RELOAD is carried over DTLS or another unreliable link protocol, 3014 it needs to be used with a reliability and congestion control 3015 mechanism, which is provided on a hop-by-hop basis, matching the 3016 semantics if TCP were used. The basic principle is that each 3017 message, regardless of if it carries a request or responses, will get 3018 an ACK and be reliably retransmitted. The receiver's job is very 3019 simple, limited to just sending ACKs. All the complexity is at the 3020 sender side. This allows the sending implementation to trade off 3021 performance versus implementation complexity without affecting the 3022 wire protocol. 3024 In order to support unreliable links, each message is wrapped in a 3025 very simple framing layer (FramedMessage) which is only used for each 3026 hop. This layer contains a sequence number which can then be used 3027 for ACKs. 3029 5.6.2.1. Framed Message Format 3031 [[TODO: There had been discussion of always using this, but it's 3032 tied up in the rest of the reliability questions.]] 3034 The definition of FramedMessage is: 3036 enum {data (128), ack (129), (255)} FramedMessageType; 3038 struct { 3039 FramedMessageType type; 3041 select (type) { 3042 case data: 3043 uint32 sequence; 3044 opaque message<0..2^24-1>; 3046 case ack: 3047 uint32 ack_sequence; 3048 uint32 received; 3049 }; 3050 } FramedMessage; 3052 The type field of the PDU is set to indicate whether the message is 3053 data or an acknowledgement. Note that these values have been set to 3054 force the first bit to be high, thus allowing easy demultiplexing 3055 with STUN. All FramedMessageType values must be > 128. 3057 If the message is of type "data", then the remainder of the PDU is as 3058 follows: 3060 sequence 3061 the sequence number 3063 message 3064 the message that is being transmitted. 3066 Each connection has it own sequence number space. Initially the 3067 value is zero and it increments by exactly one for each message sent 3068 over that connection. 3070 When the receiver receive a message, it SHOULD immediately send an 3071 ACK message. The receiver MUST keep track of the 32 most recent 3072 sequence numbers received on this association in order to generate 3073 the appropriate ack. 3075 If the PDU is of type "ack", the contents are as follows: 3077 ack_sequence 3078 The sequence number of the message being acknowledged. 3080 received 3081 A bitmask indicating is each of the previous 32 sequence numbers 3082 before this packet had been received as one of the most recently 3083 received 32 packets on this connection. When a packet is received 3084 with a sequence number N, the receiver looks at the sequence 3085 number of the previously 32 packets received on this connection,. 3086 Call the previously received packet number M. And for each of the 3087 previous 32 packets, if the sequence number M is less than N but 3088 greater than N-32, the N-M bit of the received bitmask is set to 3089 one otherwise it is zero. 3090 Note that a bit being set indicates a particular packet was 3091 received but if the bit is set to zero it only means it is unknown 3092 if it was received or not. It might have been received but not in 3093 the 32 most recently received window. 3095 The received field bits in the ACK provide a very high degree of 3096 redundancy for the sender to figure out which packets the receiver 3097 received and can then estimate packet loss rates. If the sender also 3098 keeps track of the time at which recent sequence numbers were sent, 3099 the RTT can be estimated. 3101 5.6.2.2. Retransmission and Flow Control 3103 Because the receiver's role is limited to providing packet 3104 acknowledgements, a wide variety of congestion control algorithms can 3105 be implemented on the sender side while using the same basic wire 3106 protocol. Senders MUST implement a retransmission and congestion 3107 control scheme no more aggressive then TFRC[RFC5348]. One way to do 3108 that is for senders to implement TFRC-SP [RFC4828] and use the 3109 received bitmask to allow the sender to compute packet loss event 3110 rates. 3112 5.6.2.2.1. Trivial Retransmission 3114 An algorithm which will not perform as well as TFRC-SP but is easy to 3115 implement is described in this section and can be used if 3116 implementations don't use a more advanced techniques such as TFRC-SP. 3118 A peer SHOULD retransmit a message if it has not received an ACK for 3119 that messages starting with an interval of RTO ("Retransmission 3120 TimeOut"), doubling after each retransmission. In each 3121 retransmission, the sequence number is incremented. The RTO is an 3122 estimate of the round-trip time (RTT), and is computed as described 3123 in RFC 2988 [RFC2988], with two exceptions. First, the initial value 3124 for RTO SHOULD be configurable (rather than the 3 s recommended in 3125 RFC 2988) and SHOULD be equal to or greater than 500 ms. The 3126 exception cases for this "SHOULD" are when other mechanisms are used 3127 to derive congestion thresholds, or when this is used in non- 3128 Internet environments with known network capacities. In fixed-line 3129 access links, a value of 500 ms is RECOMMENDED. Second, the value of 3130 RTO SHOULD NOT be rounded up to the nearest second. Rather, a 1 ms 3131 accuracy SHOULD be maintained. As with TCP, the usage of Karn's 3132 algorithm is RECOMMENDED [TODO REF KARN87] which means that RTT 3133 estimates SHOULD NOT be computed from transactions that result in the 3134 retransmission of a request. The value for RTO is calculated 3135 separately for each DTLS session. 3137 Retransmissions continue until a response is received, or until a 3138 total of 5 requests have been sent or there has been a hard ICMP 3139 error [RFC1122]. The receiver knows a responses was received by 3140 receiving and ACK with a sequence number that indicates it is a 3141 response to one of the transmissions of this messages. For example, 3142 assuming an RTO of 500 ms, requests would be sent at times 0 ms, 500 3143 ms, 1500 ms, 3500 ms, and 7500 ms. If all retransmissions for a 3144 message fail, the DTLS connection SHOULD be closed. 3146 Once an ACK has been received for a message, the next messages can be 3147 sent but the peer SHOULD ensure that there is at least 10 ms between 3148 sending any two messages. 3150 5.6.3. Fragmentation and Reassembly 3152 In order to allow transmission over datagram protocols such as DTLS, 3153 RELOAD messages may be fragmented. If a message is too large for a 3154 peer to transmit to the next peer it MUST fragment the message. Note 3155 that this implies that intermediate peers may re-fragment messages if 3156 the incoming and outgoing paths have different maximum datagram 3157 sizes. Intermediate peers SHOULD NOT reassemble fragments. 3159 When a message is fragmented, each fragment has a full copy of the 3160 forwarding header but the rest of the messages is split across the 3161 fragments. The fragment offset value is stored in the lower 24 bits 3162 of the fragment field of the forwarding header. The offset is the 3163 number of bytes of the start of data from the end of the forwarding 3164 header so the first fragment has an offset of 0. The first and last 3165 bit indicators MUST be appropriately set. If the message is not 3166 fragmented, then both the first and last fragment are set to 1 and 3167 the offset is 0 resulting in a fragment value of 0xC0000000. 3169 TODO - discuss how to size fragments to leave room for expansion of 3170 forwarding header. Open Issue: Remove route log? 3172 Upon receipt of a fragmented message by the intended peer, the peer 3173 holds the fragments in a holding buffer until the entire message has 3174 been received. The message is then reassembled into a single message 3175 and processed. In order to mitigate denial of service attacks, 3176 receivers SHOULD time out incomplete fragments after 15 seconds. 3177 Note the 15 seconds was derived from looking at the end to end 3178 retransmission time and saving fragments long enough for the full end 3179 to end retransmissions to take place. Ideally the receiver would 3180 have enough buffer space to deal with storing 15 seconds worth of 3181 fragments at whatever rate it receives messages on it89s interfaces, 3182 however, if the receiver runs out of buffer space to reassemble the 3183 messages it SHOULD close the DTLS session. 3185 6. Data Storage Protocol 3187 RELOAD provides a set of generic mechanisms for storing and 3188 retrieving data in the Overlay Instance. These mechanisms can be 3189 used for new applications simply by defining new code points and a 3190 small set of rules. No new protocol mechanisms are required. 3192 The basic unit of stored data is a single StoredData structure: 3194 struct { 3195 uint32 length; 3196 uint64 storage_time; 3197 uint32 lifetime; 3198 StoredDataValue value; 3199 Signature signature; 3200 } StoredData; 3202 The contents of this structure are as follows: 3204 length 3205 The length of the rest of the structure in octets. 3207 storage_time 3208 The time when the data was stored in absolute time, represented in 3209 milliseconds since the Unix epoch of midnight Jan 1, 1970. Any 3210 attempt to store a data value with a storage time before that of a 3211 value already stored at this location MUST generate a 3212 Error_Data_Too_Old error. This prevents rollback attacks. Note 3213 that this does not require synchronized clocks: the receiving 3214 peer uses the storage time in the previous store, not its own 3215 clock. 3217 lifetime 3218 The validity period for the data, in seconds, starting from the 3219 time of store. 3221 value 3222 The data value itself, as described in Section 6.2. 3224 signature 3225 A signature over the data value. Section 6.1 describes the 3226 signature computation. The element is formatted as described in 3227 Section 5.3.4 3229 Each Resource-ID specifies a single location in the Overlay Instance. 3230 However, each location may contain multiple StoredData values 3231 distinguished by Kind-ID. The definition of a kind describes both 3232 the data values which may be stored and the data model of the data. 3233 Some data models allow multiple values to be stored under the same 3234 Kind-ID. Section Section 6.2 describes the available data models. 3235 Thus, for instance, a given Resource-ID might contain a single-value 3236 element stored under Kind-ID X and an array containing multiple 3237 values stored under Kind-ID Y. 3239 6.1. Data Signature Computation 3241 Each StoredData element is individually signed. However, the 3242 signature also must be self-contained and cover the Kind-ID and 3243 Resource-ID even though they are not present in the StoredData 3244 structure. The input to the signature algorithm is: 3246 resource_id + kind + StoredData 3248 Where these values are: 3250 resource 3251 The resource ID where this data is stored. 3253 kind 3254 The Kind-ID for this data. 3256 StoredData 3257 The contents of the stored data value, as described in the 3258 previous sections, with the lifetime set to 0. 3260 [OPEN ISSUE: Should we include the identity in the string that forms 3261 the input to the signature algorithm?.] 3263 Once the signature has been computed, the signature is represented 3264 using a signature element, as described in Section 5.3.4. 3266 6.2. Data Models 3268 The protocol currently defines the following data models: 3270 o single value 3271 o array 3272 o dictionary 3274 These are represented with the StoredDataValue structure: 3276 enum { reserved(0), single_value(1), array(2), 3277 dictionary(3), (255)} DataModel; 3279 struct { 3280 Boolean exists; 3281 opaque value<0..2^32-1>; 3282 } DataValue; 3284 struct { 3285 DataModel model; 3287 select (model) { 3288 case single_value: 3289 DataValue single_value_entry; 3291 case array: 3292 ArrayEntry array_entry; 3294 case dictionary: 3295 DictionaryEntry dictionary_entry; 3297 /* This structure may be extended */ 3298 } ; 3299 } StoredDataValue; 3301 We now discuss the properties of each data model in turn: 3303 6.2.1. Single Value 3305 A single-value element is a simple, opaque sequence of bytes. There 3306 may be only one single-value element for each Resource-ID, Kind-ID 3307 pair. 3309 A single value element is represented as a DataValue, which contains 3310 the following two elements: 3312 exists 3313 This value indicates whether the value exists at all. If it is 3314 set to False, it means that no value is present. If it is True, 3315 that means that a value is present. This gives the protocol a 3316 mechanism for indicating nonexistence as opposed to emptiness. 3318 value 3319 The stored data. 3321 6.2.2. Array 3323 An array is a set of opaque values addressed by an integer index. 3324 Arrays are zero based. Note that arrays can be sparse. For 3325 instance, a Store of "X" at index 2 in an empty array produces an 3326 array with the values [ NA, NA, "X"]. Future attempts to fetch 3327 elements at index 0 or 1 will return values with "exists" set to 3328 False. 3330 A array element is represented as an ArrayEntry: 3332 struct { 3333 uint32 index; 3334 DataValue value; 3335 } ArrayEntry; 3337 The contents of this structure are: 3339 index 3340 The index of the data element in the array. 3342 value 3343 The stored data. 3345 6.2.3. Dictionary 3347 A dictionary is a set of opaque values indexed by an opaque key with 3348 one value for each key. A single dictionary entry is represented as 3349 follows 3351 A dictionary element is represented as a DictionaryEntry: 3353 typedef opaque DictionaryKey<0..2^16-1>; 3355 struct { 3356 DictionaryKey key; 3357 DataValue value; 3358 } DictionaryEntry; 3360 The contents of this structure are: 3362 key 3363 The dictionary key for this value. 3365 value 3366 The stored data. 3368 6.3. Access Control Policies 3370 Every kind which is storable in an overlay MUST be associated with an 3371 access control policy. This policy defines whether a request from a 3372 given node to operate on a given value should succeed or fail. It is 3373 anticipated that only a small number of generic access control 3374 policies are required. To that end, this section describes a small 3375 set of such policies and Section 13.3 establishes a registry for new 3376 policies if required. Each policy has a short string identifier 3377 which is used to reference it in the configuration document. 3379 6.3.1. USER-MATCH 3381 In the USER-MATCH policy, a given value MUST be written (or 3382 overwritten) if and only if the request is signed with a key 3383 associated with a certificate whose user name hashes (using the hash 3384 function for the overlay) to the Resource-ID for the resource. 3385 Recall that the certificate may, depending on the overlay 3386 configuration, be self-signed. 3388 6.3.2. NODE-MATCH 3390 In the NODE-MATCH policy, a given value MUST be written (or 3391 overwritten) if and only if the request is signed with a key 3392 associated with a certificate whose Node-ID hashes (using the hash 3393 function for the overlay) to the Resource-ID for the resource. 3395 6.3.3. USER-NODE-MATCH 3397 The USER-NODE-MATCH policy may only be used with dictionary types. 3398 In the USER-NODE-MATCH policy, a given value MUST be written (or 3399 overwritten) if and only if the request is signed with a key 3400 associated with a certificate whose user name hashes (using the hash 3401 function for the overlay) to the Resource-ID for the resource. In 3402 addition, the dictionary key MUST be equal to the Node-ID in the 3403 certificate. 3405 6.3.4. NODE-MULTIPLE 3407 In the NODE-MULTIPLE policy, a given value MUST be written (or 3408 overwritten) if and only if the request is signed with a key 3409 associated with a certificate containing a Node-ID such that 3410 H(Node-ID || i) is equal to the Resource-ID for some small integer 3411 value if i. When this policy is in use, the maximum value of i MUST 3412 be specified, typically in the configuration document. 3414 6.3.5. USER-MATCH-WITH-ANONYMOUS-CREATE 3416 The USER-MATCH-WITH-ANONYMOUS-CREATE policy is like the USER-MATCH 3417 policy except that any user MAY create a new value in a given 3418 location. However, only a user matching the USER-MATCH criteria may 3419 overwrite an existing value. This allows the creation of an 3420 anonymous "drop box" which may be useful for applications like voice 3421 mail. 3423 6.4. Data Storage Methods 3425 RELOAD provides several methods for storing and retrieving data: 3427 o Store values in the overlay 3428 o Fetch values from the overlay 3429 o Find the values stored at an individual peer 3431 These methods are each described in the following sections. 3433 6.4.1. Store 3435 The Store method is used to store data in the overlay. The format of 3436 the Store request depends on the data model which is determined by 3437 the kind. 3439 6.4.1.1. Request Definition 3441 A StoreReq message is a sequence of StoreKindData values, each of 3442 which represents a sequence of stored values for a given kind. The 3443 same Kind-ID MUST NOT be used twice in a given store request. Each 3444 value is then processed in turn. These operations MUST be atomic. 3445 If any operation fails, the state MUST be rolled back to before the 3446 request was received. 3448 The store request is defined by the StoreReq structure: 3450 struct { 3451 KindId kind; 3452 DataModel data_model; 3453 uint64 generation_counter; 3454 StoredData values<0..2^32-1>; 3455 } StoreKindData; 3457 struct { 3458 ResourceId resource; 3459 uint8 replica_number; 3460 StoreKindData kind_data<0..2^32-1>; 3461 } StoreReq; 3463 A single Store request stores data of a number of kinds to a single 3464 resource location. The contents of the structure are: 3466 resource 3467 The resource to store at. 3469 replica_number 3470 The number of this replica. When a storing peer saves replicas to 3471 other peers each peer is assigned a replica number starting from 1 3472 and sent in the Store message. This field is set to 0 when a node 3473 is storing its own data. This allows peers to distinguish replica 3474 writes from original writes. 3476 kind_data 3477 A series of elements, one for each kind of data to be stored. 3479 If the replica number is zero, then the peer MUST check that it is 3480 responsible for the resource and if not reject the request. If the 3481 replica number is nonzero, then the peer MUST check that it expects 3482 to be a replica for the resource and that the request sender is 3483 consistent with being the responsible node (i.e., that the receiving 3484 peer does not know of a better node) and if not reject the request. 3486 Each StoreKindData element represents the data to be stored for a 3487 single Kind-ID. The contents of the element are: 3489 kind 3490 The Kind-ID. Implementations SHOULD reject requests corresponding 3491 to unknown kinds unless specifically configured otherwise. 3493 data_model 3494 The data model of the data. The kind defines what this has to be 3495 so this is redundant in the case where the software interpreting 3496 the messages understands the kind. 3498 generation 3499 The expected current state of the generation counter 3500 (approximately the number of times this object has been written, 3501 see below for details). 3503 values 3504 The value or values to be stored. This may contain one or more 3505 stored_data values depending on the data model associated with 3506 each kind. 3508 The peer MUST perform the following checks: 3510 o The kind_id is known and supported. 3511 o The data_model matches the kind_id. 3512 o The signatures over each individual data element (if any) are 3513 valid. 3514 o Each element is signed by a credential which is authorized to 3515 write this kind at this Resource-ID 3516 o For original (non-replica) stores, the peer MUST check that if the 3517 generation-counter is non-zero, it equals the current value of the 3518 generation-counter for this kind. This feature allows the 3519 generation counter to be used in a way similar to the HTTP Etag 3520 feature. 3521 o The storage time values are greater than that of any value which 3522 would be replaced by this Store. 3524 If all these checks succeed, the peer MUST attempt to store the data 3525 values. For non-replica stores, if the store succeeds and the data 3526 is changed, then the peer must increase the generation counter by at 3527 least one. If there are multiple stored values in a single 3528 StoreKindData, it is permissible for the peer to increase the 3529 generation counter by only 1 for the entire Kind-ID, or by 1 or more 3530 than one for each value. Accordingly, all stored data values must 3531 have a generation counter of 1 or greater. 0 is used in the Store 3532 request to indicate that the generation counter should be ignored for 3533 processing this request, however the responsible peer should increase 3534 the stored generation counter, and should return the correct 3535 generation counter in the response. 3537 For replica Stores, the peer MUST set the generation counter to match 3538 the generation_counter in the message, and MUST NOT check the 3539 generation counter against the current value. Replica Stores MUST 3540 NOT use a generation counter of 0. 3542 When a peer stores data previously stored by another node (e.g., for 3543 replicas or topology shifts) it MUST adjust the lifetime value 3544 downward to reflect the amount of time the value was stored at the 3545 peer. 3547 The properties of stores for each data model are as follows: 3549 Single-value: 3550 A store of a new single-value element creates the element if it 3551 does not exist and overwrites any existing value with the new 3552 value. 3554 Array: 3555 A store of an array entry replaces (or inserts) the given value at 3556 the location specified by the index. Because arrays are sparse, a 3557 store past the end of the array extends it with nonexistent values 3558 (exists=False) as required. A store at index 0xffffffff places 3559 the new value at the end of the array regardless of the length of 3560 the array. The resulting StoredData has the correct index value 3561 when it is subsequently fetched. 3563 Dictionary: 3564 A store of a dictionary entry replaces (or inserts) the given 3565 value at the location specified by the dictionary key. 3567 The following figure shows the relationship between these structures 3568 for an example store which stores the following values at resource 3569 "1234" 3571 o The value "abc" in the single value slot for kind X 3572 o The value "foo" at index 0 in the array for kind Y 3573 o The value "bar" at index 1 in the array for kind Y 3574 Store 3575 resource=1234 3576 / \ 3577 / \ 3578 StoreKindData StoreKindData 3579 kind=X kind=Y 3580 model=Single-Value model=Array 3581 | /\ 3582 | / \ 3583 StoredData / \ 3584 | / \ 3585 | StoredData StoredData 3586 StoredDataValue | | 3587 value="abc" | | 3588 | | 3589 StoredDataValue StoredDataValue 3590 index=0 index=1 3591 value="foo" value="bar" 3593 6.4.1.2. Response Definition 3595 In response to a successful Store request the peer MUST return a 3596 StoreAns message containing a series of StoreKindResponse elements 3597 containing the current value of the generation counter for each 3598 Kind-ID, as well as a list of the peers where the data was/will-be 3599 replicated. 3601 struct { 3602 KindId kind; 3603 uint64 generation_counter; 3604 NodeId replicas<0..2^16-1>; 3605 } StoreKindResponse; 3607 struct { 3608 StoreKindResponse kind_responses<0..2^16-1>; 3609 } StoreAns; 3611 The contents of each StoreKindResponse are: 3613 kind 3614 The Kind-ID being represented. 3616 generation 3617 The current value of the generation counter for that Kind-ID. 3619 replicas 3620 The list of other peers at which the data was/will-be replicated. 3621 In overlays and applications where the responsible peer is 3622 intended to store redundant copies, this allows the storing peer 3623 to independently verify that the replicas were in fact stored by 3624 doing its own Fetch. 3626 The response itself is just StoreKindResponse values packed end-to- 3627 end. 3629 If any of the generation counters in the request precede the 3630 corresponding stored generation counter, then the peer MUST fail the 3631 entire request and respond with a Error_Data_Too_Old error. The 3632 error_info in the ErrorResponse MUST be a StoreAns response 3633 containing the correct generation counter for each kind and empty 3634 replicas lists. 3636 If the data being stored is too large for the allowed limit by the 3637 given usage, then the peer MUST fail the request and generate an 3638 Error_Data_Too_Large error. 3640 6.4.1.3. Removing Values 3642 This version of RELOAD (unlike previous versions) does not have an 3643 explicit Remove operation. Rather, values are Removed by storing 3644 "nonexistent" values in their place. Each DataValue contains a 3645 boolean value called "exists" which indicates whether a value is 3646 present at that location. In order to effectively remove a value, 3647 the owner stores a new DataValue with: 3649 exists = false 3650 value = {} (0 length) 3652 Storing nodes MUST treat these nonexistent values the same way they 3653 treat any other stored value, including overwriting the existing 3654 value, replicating them, and aging them out as necessary when 3655 lifetime expires. When a stored nonexistent value's lifetime 3656 expires, it is simply removed from the storing node like any other 3657 stored value expiration. Note that in the case of arrays and 3658 dictionaries, this may create an implicit, unsigned "nonexistent" 3659 value to represent a gap in the data structure. However, this value 3660 isn't persistent nor is it replicated, it's simply synthesized by the 3661 storing node. 3663 6.4.2. Fetch 3665 The Fetch request retrieves one or more data elements stored at a 3666 given Resource-ID. A single Fetch request can retrieve multiple 3667 different kinds. 3669 6.4.2.1. Request Definition 3671 struct { 3672 int32 first; 3673 int32 last; 3674 } ArrayRange; 3676 struct { 3677 KindId kind; 3678 DataModel model; 3679 uint64 generation; 3680 uint16 length; 3682 select (model) { 3683 case single_value: ; /* Empty */ 3685 case array: 3686 ArrayRange indices<0..2^16-1>; 3688 case dictionary: 3689 DictionaryKey keys<0..2^16-1>; 3691 /* This structure may be extended */ 3693 } model_specifier; 3694 } StoredDataSpecifier; 3696 struct { 3697 ResourceId resource; 3698 StoredDataSpecifier specifiers<0..2^16-1>; 3699 } FetchReq; 3701 The contents of the Fetch requests are as follows: 3703 resource 3704 The resource ID to fetch from. 3706 specifiers 3707 A sequence of StoredDataSpecifier values, each specifying some of 3708 the data values to retrieve. 3710 Each StoredDataSpecifier specifies a single kind of data to retrieve 3711 and (if appropriate) the subset of values that are to be retrieved. 3712 The contents of the StoredDataSpecifier structure are as follows: 3714 kind 3715 The Kind-ID of the data being fetched. Implementations SHOULD 3716 reject requests corresponding to unknown kinds unless specifically 3717 configured otherwise. 3719 model 3720 The data model of the data. This must be checked against the 3721 Kind-ID. 3723 generation 3724 The last generation counter that the requesting peer saw. This 3725 may be used to avoid unnecessary fetches or it may be set to zero. 3727 length 3728 The length of the rest of the structure, thus allowing 3729 extensibility. 3731 model_specifier 3732 A reference to the data value being requested within the data 3733 model specified for the kind. For instance, if the data model is 3734 "array", it might specify some subset of the values. 3736 The model_specifier is as follows: 3738 o If the data is of data model single value, the specifier is empty. 3739 o If the data is of data model array, the specifier contains of a 3740 list of ArrayRange elements, each of which contains two integers. 3741 The first integer is the beginning of the range and the second is 3742 the end of the range. 0 is used to indicate the first element and 3743 0xffffffff is used to indicate the final element. The beginning 3744 of the range MUST be earlier in the array then the end. The 3745 ranges MUST be non-overlapping. 3746 o If the data is of data model dictionary then the specifier 3747 contains a list of the dictionary keys being requested. If no 3748 keys are specified, than this is a wildcard fetch and all key- 3749 value pairs are returned. 3751 The generation-counter is used to indicate the requester's expected 3752 state of the storing peer. If the generation-counter in the request 3753 matches the stored counter, then the storing peer returns a response 3754 with no StoredData values. 3756 Note that because the certificate for a user is typically stored at 3757 the same location as any data stored for that user, a requesting peer 3758 which does not already have the user's certificate should request the 3759 certificate in the Fetch as an optimization. 3761 6.4.2.2. Response Definition 3763 The response to a successful Fetch request is a FetchAns message 3764 containing the data requested by the requester. 3766 struct { 3767 KindId kind; 3768 uint64 generation; 3769 StoredData values<0..2^32-1>; 3770 } FetchKindResponse; 3772 struct { 3773 FetchKindResponse kind_responses<0..2^32-1>; 3774 } FetchAns; 3776 The FetchAns structure contains a series of FetchKindResponse 3777 structures. There MUST be one FetchKindResponse element for each 3778 Kind-ID in the request. 3780 The contents of the FetchKindResponse structure are as follows: 3782 kind 3783 the kind that this structure is for. 3785 generation 3786 the generation counter for this kind. 3788 values 3789 the relevant values. If the generation counter in the request 3790 matches the generation-counter in the stored data, then no 3791 StoredData values are returned. Otherwise, all relevant data 3792 values MUST be returned. A nonexistent value is represented with 3793 "exists" set to False. 3795 There is one subtle point about signature computation on arrays. If 3796 the storing node uses the append feature (where the 3797 index=0xffffffff), then the index in the StoredData that is returned 3798 will not match that used by the storing node, which would break the 3799 signature. In order to avoid this issue, the index value in array is 3800 set to zero before the signature is computed. This implies that 3801 malicious storing nodes can reorder array entries without being 3802 detected. [[OPEN ISSUE: We've considered a number of alternate 3803 designs here that would preserve security against this attack if the 3804 storing node did not use the append feature. However, they are more 3805 complicated for one or both sides. If this attack is considered 3806 serious, we can introduce one of them.]] 3808 6.4.3. Stat 3810 The Stat request is used to get metadata (length, generation counter, 3811 digest, etc.) for a stored element without retrieving the element 3812 itself. The name is from the UNIX stat(2) system call which performs 3813 a similar function for files in a filesystem. It also allows the 3814 requesting node to get a list of matching elements without requesting 3815 the entire element. 3817 6.4.3.1. Request Definition 3819 The Stat request is identical to the Fetch request. It simply 3820 specifies the elements to get metadata about. 3822 struct { 3823 ResourceId resource; 3824 StoredDataSpecifier specifiers<0..2^16-1>; 3825 } StatReq; 3827 6.4.3.2. Response Definition 3829 The Stat response contains the same sort of entries that a Fetch 3830 response would contain, however instead of containing the element 3831 data it contains metadata. 3833 struct { 3834 Boolean exists; 3835 uint32 value_length; 3836 HashAlgorithm hash_algorithm; 3837 opaque hash_value<0..255>; 3838 } MetaData; 3840 struct { 3841 uint32 index; 3842 MetaData value; 3844 } ArrayEntryMeta; 3846 struct { 3847 DictionaryKey key; 3848 MetaData value; 3849 } DictionaryEntryMeta; 3851 struct { 3852 DataModel model; 3854 select (model) { 3855 case single_value: 3856 MetaData single_value_entry; 3858 case array: 3859 ArrayEntryMeta array_entry; 3861 case dictionary: 3862 DictionaryEntryMeta dictionary_entry; 3864 /* This structure may be extended */ 3865 } ; 3866 } MetaDataValue; 3868 struct { 3869 uint32 length; 3870 uint64 storage_time; 3871 uint32 lifetime; 3872 MetaDataValue metadata; 3873 } StoredMetaData; 3875 struct { 3876 KindId kind; 3877 uint64 generation; 3878 StoredMetaData values<0..2^32-1>; 3879 } StatKindResponse; 3881 struct { 3882 StatKindResponse kind_responses<0..2^32-1>; 3883 } StatAns; 3885 The structures used in StatAns parallel those used in FetchAns: a 3886 response consists of multiple StatKindResponse values, one for each 3887 kind that was in the request. The contents of the StatKindResponse 3888 are the same as those in the FetchKindResponse, except that the 3889 values list contains StoredMetaData entries instead of StoredData 3890 entries. 3892 The contents of the StoredMetaData structure are the same as the 3893 corresponding fields in StoredData except that there is no signature 3894 field and the value is a MetaDataValue rather than a StoredDataValue. 3896 A MetaDataValue is a variant structure, like a StoredDataValue, 3897 except for the types of each arm, which replace DataValue with 3898 MetaData. 3900 The only really new structure is MetaData, which has the following 3901 contents: 3903 exists 3904 Same as in DataValue 3906 value_length 3907 The length of the stored value. 3909 hash_algorithm 3910 The hash algorithm used to perform the digest of the value. 3912 hash_value 3913 A digest of the value using hash_algorithm. 3915 6.4.4. Find 3917 The Find request can be used to explore the Overlay Instance. A Find 3918 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 3919 (if any) of the resource of kind T known to the target peer which is 3920 closes to R. This method can be used to walk the Overlay Instance by 3921 interactively fetching R_n+1=nearest(1 + R_n). 3923 6.4.4.1. Request Definition 3925 The FindReq message contains a series of Resource-IDs and Kind-IDs 3926 identifying the resource the peer is interested in. 3928 struct { 3929 ResourceID resource; 3930 KindId kinds<0..2^8-1>; 3931 } FindReq; 3933 The request contains a list of Kind-IDs which the Find is for, as 3934 indicated below: 3936 resource 3937 The desired Resource-ID 3939 kinds 3940 The desired Kind-IDs. Each value MUST only appear once. 3942 6.4.4.2. Response Definition 3944 A response to a successful Find request is a FindAns message 3945 containing the closest Resource-ID for each kind specified in the 3946 request. 3948 struct { 3949 KindId kind; 3950 ResourceID closest; 3951 } FindKindData; 3953 struct { 3954 FindKindData results<0..2^16-1>; 3955 } FindAns; 3957 If the processing peer is not responsible for the specified 3958 Resource-ID, it SHOULD return a 404 error. 3960 For each Kind-ID in the request the response MUST contain a 3961 FindKindData indicating the closest Resource-ID for that Kind-ID 3962 unless the kind is not allowed to be used with Find in which case a 3963 FindKindData for that Kind-ID MUST NOT be included in the response. 3964 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 3965 0. Note that different Kind-IDs may have different closest Resource- 3966 IDs. 3968 The response is simply a series of FindKindData elements, one per 3969 kind, concatenated end-to-end. The contents of each element are: 3971 kind 3972 The Kind-ID. 3974 closest 3975 The closest resource ID to the specified resource ID. This is 0 3976 if no resource ID is known. 3978 Note that the response does not contain the contents of the data 3979 stored at these Resource-IDs. If the requester wants this, it must 3980 retrieve it using Fetch. 3982 6.4.5. Defining New Kinds 3984 There are two ways to define a new kind. The first is by writing a 3985 document and registering the kind-id with IANA. This is the 3986 preferred method for kinds which may be widely used and reused. The 3987 second method is to simply define the kind and its parameters in the 3988 configuration document using the section of kind-id space set aside 3989 for private use. This method MAY be used to define ad hoc kinds in 3990 new overlays. 3992 However a kind is defined, the definition must include: 3994 o The meaning of the data to be stored (in some textual form). 3995 o The Kind-ID. 3996 o The data model (single value, array, dictionary, etc.) 3997 o The access control model. 3999 In addition, when kinds are registered with IANA, each kind is 4000 assigned a short string name which is used to refer to it in 4001 configuration documents. 4003 While each kind MUST define what data model is used for its data, 4004 that does not mean that it must define new data models. Where 4005 practical, kinds SHOULD use the built-in data models. However, they 4006 MAY define any new required data models. The intention is that the 4007 basic data model set be sufficient for most applications/usages. 4009 7. Certificate Store Usage 4011 The Certificate Store usage allows a peer to store its certificate in 4012 the overlay, thus avoiding the need to send a certificate in each 4013 message - a reference may be sent instead. 4015 A user/peer MUST store its certificate at Resource-IDs derived from 4016 two Resource Names: 4018 o The user name in the certificate. 4019 o The Node-ID in the certificate. 4021 Note that in the second case the certificate is not stored at the 4022 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4023 intention here (as is common throughout RELOAD) is to avoid making a 4024 peer responsible for its own data. 4026 A peer MUST ensure that the user's certificates are stored in the 4027 Overlay Instance. New certificates are stored at the end of the 4028 list. This structure allows users to store and old and new 4029 certificate the both have the same Node-ID which allows for migration 4030 of certificates when they are renewed. 4032 This usage defines the following kind: 4034 Name: CERTIFICATE 4036 Data Model: The data model for CERTIFICATE data is array. 4038 Access Control: NODE-MATCH. 4040 8. TURN Server Usage 4042 The TURN server usage allows a RELOAD peer to advertise that it is 4043 prepared to be a TURN server as defined in [I-D.ietf-behave-turn]. 4044 When a node starts up, it joins the overlay network and forms several 4045 connection in the process. If the ICE stage in any of these 4046 connection return a reflexive address that is not the same as the 4047 peers perceived address, then the peers is behind a NAT and not an 4048 candidate for a TURN server. Additionally, if the peers IP address 4049 is in the private address space range, then it is not a candidate for 4050 a TURN server. Otherwise, the peer SHOULD assume it is a potential 4051 TURN server and follow the procedures below. 4053 If the node is a candidate for a TURN server it will insert some 4054 pointers in the overlay so that other peers can find it. The overlay 4055 configuration file specifies a turnDensity parameter that indicates 4056 how many times each TURN server should record itself in the overlay. 4057 Typically this should be set to the reciprocal of the estimate of 4058 what percentage of peers will act as TURN servers. For each value, 4059 called d, between 1 and turnDensity, the peer forms a Resource Name 4060 by concatenating its Peer-ID and the value d. This Resource Name is 4061 hashed to form a Resource-ID. The address of the peer is stored at 4062 that Resource-ID using type TURN-SERVICE and the TurnServer object: 4064 struct { 4065 uint8 iteration; 4066 IpAddressAndPort server_address; 4067 } TurnServer; 4069 The contents of this structure are as follows: 4071 iteration 4072 the d value 4074 server_address 4075 the address at which the TURN server can be contacted. 4077 Note: Correct functioning of this algorithm depends critically on 4078 having turnDensity be an accurate estimate of the true density of 4079 TURN servers. If turnDensity is too high, then the process of 4080 finding TURN servers becomes extremely expensive as multiple 4081 candidate Resource-IDs must be probed. 4083 Peers peers that provide this service need to support the TURN 4084 extensions to STUN for media relay of both UDP and TCP traffic as 4085 defined in [I-D.ietf-behave-turn] and [RFC5382]. 4087 [[OPEN ISSUE: This structure only works for TURN servers that have 4088 public addresses. It may be possible to use TURN servers that are 4089 behind well-behaved NATs by first ICE connecting to them. If we 4090 decide we want to enable that, this structure will need to change to 4091 either be a Peer-ID or include that as an option.]] 4093 This usage defines the following kind to indicate that the a peer is 4094 willing to act as a TURN server: 4096 Name TURN-SERVICE 4097 Data Model The TURN-SERVICE kind stores a single value for each 4098 Resource-ID. 4099 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4101 Peers can find other servers by selecting a random Resource-ID and 4102 then doing a Find request for the appropriate server type with that 4103 Resource-ID. The Find request gets routed to a random peer based on 4104 the Resource-ID. If that peer knows of any servers, they will be 4105 returned. The returned response may be empty if the peer does not 4106 know of any servers, in which case the process gets repeated with 4107 some other random Resource-ID. As long as the ratio of servers 4108 relative to peers is not too low, this approach will result in 4109 finding a server relatively quickly. 4111 9. Chord Algorithm 4113 This algorithm is assigned the name chord-128-2-16+ to indicate it is 4114 based on Chord, uses SHA-1 then truncates that to 128 bit for the 4115 hash function, stores 2 redundant copies of all data, and has finger 4116 tables with at least 16 entries. 4118 9.1. Overview 4120 The algorithm described here is a modified version of the Chord 4121 algorithm. Each peer keeps track of a finger table of 16 entries and 4122 a neighbor table of 6 entries. The neighbor table contains the 3 4123 peers before this peer and the 3 peers after it in the DHT ring. The 4124 first entry in the finger table contains the peer half-way around the 4125 ring from this peer; the second entry contains the peer that is 1/4 4126 of the way around; the third entry contains the peer that is 1/8th of 4127 the way around, and so on. Fundamentally, the chord data structure 4128 can be thought of a doubly-linked list formed by knowing the 4129 successors and predecessor peers in the neighbor table, sorted by the 4130 Node-ID. As long as the successor peers are correct, the DHT will 4131 return the correct result. The pointers to the prior peers are kept 4132 to enable inserting of new peers into the list structure. Keeping 4133 multiple predecessor and successor pointers makes it possible to 4134 maintain the integrity of the data structure even when consecutive 4135 peers simultaneously fail. The finger table forms a skip list, so 4136 that entries in the linked list can be found in O(log(N)) time 4137 instead of the typical O(N) time that a linked list would provide. 4139 A peer, n, is responsible for a particular Resource-ID k if k is less 4140 than or equal to n and k is greater than p, where p is the peer id of 4141 the previous peer in the neighbor table. Care must be taken when 4142 computing to note that all math is modulo 2^128. 4144 9.2. Reactive vs Periodic Recovery 4146 Open Issue: The algorithm currently presented in this section uses 4147 reactive recovery when a neighbor is lost, that information is 4148 immediately propagated. Research in DHT performance by Rhea et al. 4149 indicates that this is not optimal in large-scale networks with churn 4150 [handling-churn-usenix04]. Addressing this issue, however, needs to 4151 take into account the requirements placed on this algorithm. Because 4152 it is the mandatory DHT for RELOAD, the algorithm described here is 4153 designed to meet two primary challenges: 4154 o Scale from small (ten or fewer) overlays on a LAN to global 4155 overlays with millions of nodes 4156 o Simple to implement 4158 One of the challenges these requirements entail is achieving 4159 reasonable performance as the overlay scales without undue 4160 complexity. We have two possibly conflicting concerns: 4161 o A small-scale overlay may not be stable without reactive recovery, 4162 because a single peer represents a large portion of the overlay. 4163 o A large-scale overlay with significant churn may perform poorly, 4164 both in terms of traffic volume and success rates, when using 4165 reactive recovery. 4167 As a result, multiple solutions have been proposed: 4168 o Identify one set of behaviors that achieves adequate functionality 4169 as the overlay scales. 4170 o Add a parameter dictating the type of recovery used by peers in 4171 the overlay, configuring the peers appropriately as they join the 4172 overlay. 4173 o Make the algorithm adaptive, according to the size of the overlay 4174 or the churn rates observed. 4176 At IETF 72, the WG elected to defer a decision on the final choice 4177 until data could be collected on the effectiveness of the strategies. 4178 This section, therefore, retains the reactive recovery model until 4179 evidence supporting a decision is available. 4181 9.3. Routing 4183 If a peer is not responsible for a Resource-ID k, but is directly 4184 connected to a node with Node-ID k, then it routes the message to 4185 that node. Otherwise, it routes the request to the peer in the 4186 routing table that has the largest Node-ID that is in the interval 4187 between the peer and k. The routing table is the union of the 4188 neighbor table and the finger table. 4190 9.4. Redundancy 4192 When a peer receives a Store request for Resource-ID k, and it is 4193 responsible for Resource-ID k, it stores the data and returns a 4194 success response. [[Open Issue: should it delay sending this 4195 success until it has successfully stored the redundant copies?]]. It 4196 then sends a Store request to its successor in the neighbor table and 4197 to that peers successor. Note that these Store requests are 4198 addressed to those specific peers, even though the Resource-ID they 4199 are being asked to store is outside the range that they are 4200 responsible for. The peers receiving these check they came from an 4201 appropriate predecessor in their neighbor table and that they are in 4202 a range that this predecessor is responsible for, and then they store 4203 the data. They do not themselves perform further Stores because they 4204 can determine that they are not responsible for the Resource-ID. 4206 Note that a malicious node can return a success response but not 4207 store the data locally or in the replica set. Requesting peers that 4208 wish to ensure that the replication actually occurred SHOULD [[Open 4209 Issue: SHOULD or MAY?]] contact each peer listed in the replicas 4210 field of the Store response and retrieve a copy of the data. 4212 9.5. Joining 4214 The join process for a joining party (JP) with Node-ID n is as 4215 follows. 4217 1. JP connects to its chosen bootstrap node. 4218 2. JP uses a series of Probes to populate its routing table. 4219 3. JP sends Attach requests to initiate connections to each of the 4220 peers in the connection table as well as to the desired finger 4221 table entries. Note that this does not populate their routing 4222 tables, but only their connection tables, so JP will not get 4223 messages that it is expected to route to other nodes. 4224 4. JP enters all the peers it contacted into its routing table. 4225 5. JP sends a Join to its immediate successor, the admitting peer 4226 (AP) for Node-ID n. The AP sends the response to the Join. 4227 6. AP does a series of Store requests to JP to store the data that 4228 JP will be responsible for. 4229 7. AP sends JP an Update explicitly labeling JP as its predecessor. 4230 At this point, JP is part of the ring and responsible for a 4231 section of the overlay. AP can now forget any data which is 4232 assigned to JP and not AP. 4233 8. AP sends an Update to all of its neighbors with the new values of 4234 its neighbor set (including JP). 4235 9. JP sends Updates to all the peers in its routing table. 4237 In order to populate its routing table, JP sends a Probe via the 4238 bootstrap node directed at Resource-ID n+1 (directly after its own 4239 Resource-ID). This allows it to discover its own successor. Call 4240 that node p0. It then sends a probe to p0+1 to discover its 4241 successor (p1). This process can be repeated to discover as many 4242 successors as desired. The values for the two peers before p will be 4243 found at a later stage when n receives an Update. 4245 In order to set up its neighbor table entry for peer i, JP simply 4246 sends an Attach to peer (n+2^(numBitsInNodeId-i). This will be 4247 routed to a peer in approximately the right location around the ring. 4249 9.6. Routing Attaches 4251 When a peer needs to Attach to a new peer in its neighbor table, it 4252 MUST source-route the Attach request through the peer from which it 4253 learned the new peer's Node-ID. Source-routing these requests allows 4254 the overlay to recover from instability. 4256 All other Attach requests, such as those for new finger table 4257 entries, are routed conventionally through the overlay. 4259 If a peer is unable to successfully Attach with a peer that should be 4260 in its neighborhood, it MUST locate either a TURN server or another 4261 peer in the overlay, but not in its neighborhood, through which it 4262 can exchange messages with its neighbor peer 4264 9.7. Updates 4266 A chord Update is defined as 4268 enum { reserved (0), 4269 peer_ready(1), neighbors(2), full(3), (255) } 4270 ChordUpdateType; 4272 struct { 4273 ChordUpdateType type; 4275 select(type){ 4276 case peer_ready: /* Empty */ 4277 ; 4279 case neighbors: 4280 NodeId predecessors<0..2^16-1>; 4281 NodeId successors<0..2^16-1>; 4283 case full: 4284 NodeId predecessors<0..2^16-1>; 4285 NodeId successors<0..2^16-1>; 4286 NodeId fingers<0..2^16-1>; 4287 }; 4288 } ChordUpdate; 4290 The "type" field contains the type of the update, which depends on 4291 the reason the update was sent. 4293 peer_ready: this peer is ready to receive messages. This message 4294 is used to indicate that a node which has Attached is a peer and 4295 can be routed through. It is also used as a connectivity check to 4296 non-neighbor peers. 4297 neighbors: this version is sent to members of the Chord neighbor 4298 table. 4299 full: this version is sent to peers which request an Update with a 4300 RouteQueryReq. 4302 If the message is of type "neighbors", then the contents of the 4303 message will be: 4305 predecessors 4306 The predecessor set of the Updating peer. 4308 successors 4309 The successor set of the Updating peer. 4311 If the message is of type "full", then the contents of the message 4312 will be: 4314 predecessors 4315 The predecessor set of the Updating peer. 4317 successors 4318 The successor set of the Updating peer. 4320 fingers 4321 The finger table if the Updating peer, in numerically ascending 4322 order. 4324 A peer MUST maintain an association (via Attach) to every member of 4325 its neighbor set. A peer MUST attempt to maintain at least three 4326 predecessors and three successors. However, it MUST send its entire 4327 set in any Update message sent to neighbors. 4329 9.7.1. Sending Updates 4331 Every time a connection to a peer in the neighbor table is lost (as 4332 determined by connectivity probes or failure of some request), the 4333 peer should remove the entry from its neighbor table and replace it 4334 with the best match it has from the other peers in its routing table. 4335 It then sends an Update to all its remaining neighbors. The update 4336 will contain all the Node-IDs of the current entries of the table 4337 (after the failed one has been removed). Note that when replacing a 4338 successor the peer SHOULD delay the creation of new replicas for 30 4339 seconds after removing the failed entry from its neighbor table in 4340 order to allow a triggered update to inform it of a better match for 4341 its neighbor table. 4343 If connectivity is lost to all three of the peers that follow this 4344 peer in the ring, then this peer should behave as if it is joining 4345 the network and use Probes to find a peer and send it a Join. If 4346 connectivity is lost to all the peers in the finger table, this peer 4347 should assume that it has been disconnected from the rest of the 4348 network, and it should periodically try to join the DHT. 4350 9.7.2. Receiving Updates 4352 When a peer, N, receives an Update request, it examines the Node-IDs 4353 in the UpdateReq and at its neighbor table and decides if this 4354 UpdateReq would change its neighbor table. This is done by taking 4355 the set of peers currently in the neighbor table and comparing them 4356 to the peers in the update request. There are three major cases: 4358 o The UpdateReq contains peers that would not change the neighbor 4359 set because they match the neighbor table. 4360 o The UpdateReq contains peers closer to N than those in its 4361 neighbor table. 4362 o The UpdateReq defines peers that indicate a neighbor table further 4363 away from N than some of its neighbor table. Note that merely 4364 receiving peers further away does not demonstrate this, since the 4365 update could be from a node far away from N. Rather, the peers 4366 would need to bracket N. 4368 In the first case, no change is needed. 4370 In the second case, N MUST attempt to Attach to the new peers and if 4371 it is successful it MUST adjust its neighbor set accordingly. Note 4372 that it can maintain the now inferior peers as neighbors, but it MUST 4373 remember the closer ones. 4375 The third case implies that a neighbor has disappeared, most likely 4376 because it has simply been disconnected but perhaps because of 4377 overlay instability. N MUST Probe the questionable peers to discover 4378 if they are indeed missing and if so, remove them from its neighbor 4379 table. 4381 After any Probes and Attaches are done, if the neighbor table 4382 changes, the peer sends an Update request to each of its neighbors 4383 that was in either the old table or the new table. These Update 4384 requests are what ends up filling in the predecessor/successor tables 4385 of peers that this peer is a neighbor to. A peer MUST NOT enter 4386 itself in its successor or predecessor table and instead should leave 4387 the entries empty. 4389 If peer N which is responsible for a Resource-ID R discovers that the 4390 replica set for R (the next two nodes in its successor set) has 4391 changed, it MUST send a Store for any data associated with R to any 4392 new node in the replica set. It SHOULD NOT delete data from peers 4393 which have left the replica set. 4395 When a peer N detects that it is no longer in the replica set for a 4396 resource R (i.e., there are three predecessors between N and R), it 4397 SHOULD delete all data associated with R from its local store. 4399 9.7.3. Stabilization 4401 There are four components to stabilization: 4402 1. exchange Updates with all peers in its routing table to exchange 4403 state 4404 2. search for better peers to place in its finger table 4405 3. search to determine if the current finger table size is 4406 sufficiently large 4407 4. search to determine if the overlay has partitioned and needs to 4408 recover 4410 A peer MUST periodically send an Update request to every peer in its 4411 routing table. The purpose of this is to keep the predecessor and 4412 successor lists up to date and to detect connection failures. The 4413 default time is about every ten minutes, but the enrollment server 4414 SHOULD set this in the configuration document using the "chord-128-2- 4415 16+-update-frequency" element (denominated in seconds.) A peer 4416 SHOULD randomly offset these Update requests so they do not occur all 4417 at once. If an Update request fails or times out, the peer MUST mark 4418 that entry in the neighbor table invalid and attempt to reestablish a 4419 connection. If no connection can be established, the peer MUST 4420 attempt to establish a new peer as its neighbor and do whatever 4421 replica set adjustments are required. If a finger table entry is 4422 found to have failed, the peer MUST search for a replacement as 4423 directed below. 4425 A peer MUST periodically select a random entry i from the finger 4426 table and evaluate whether that entry should be replaced. The 4427 default time interval is about every hour, but the enrollment server 4428 SHOULD set this in the configuration document using the "chord-128-2- 4429 16+-probe-frequency" element (denominated in seconds). 4431 To evaluate whether the i'th finger table entry needs to be replaced, 4432 if the Node-ID of the entry is not valid for that finger table entry, 4433 the peer SHOULD search for a better entry. A peer searches for a 4434 better entry using a Probe request. If the Probe returns a different 4435 peer than the one currently in this entry of the finger table, then a 4436 new connection should be formed to replace the old entry in the 4437 finger table. 4439 A peer SHOULD consider the finger table entry valid if it is in the 4440 range [n+2^(numBitsInNodeId-i), n+2^(numBitsInNodeId-(i-1))- 4441 2^(numBitsInNodeId-(i+1))]. When searching for a better entry, the 4442 peer SHOULD send the Probe to a Node-ID selected randomly from that 4443 range. Random selection is preferred over a search for strictly 4444 spaced entries to minimize the effect of churn on overlay routing 4445 [minimizing-churn-sigcomm06]. An implementation or subsequent 4446 specification MAY choose a method for selecting finger table entries 4447 other than choosing randomly within the range. It is RECOMMENDED 4448 that any such alternate methods be employed only on finger table 4449 stabilization and not for the selection of initial finger table 4450 entries unless the alternative method is faster and imposes less 4451 overhead on the overlay. 4453 As an overlay grows, more than 16 entries may be required in the 4454 finger table for efficient routing. To determine if its finger table 4455 is sufficiently large, once an hour the peer should perform a Probe 4456 to determine whether growing its finger table by four entries would 4457 result in it learning at least two peers that it does not already 4458 have in its neighbor table. If so, then the finger table SHOULD be 4459 grown by four entries. Similarly, if the peer observes that its 4460 closest finger table entries are also in its neighbor table, it MAY 4461 shrink its finger table to the minimum size of 16 entries. [[OPEN 4462 ISSUE: there are a variety of algorithms to gauge the population of 4463 the overlay and select an appropriate finger table size. Need to 4464 consider which is the best combination of effectiveness and 4465 simplicity. Also, an example would help here.]] 4467 To detect that a partitioning has occurred and to heal the overlay, a 4468 peer P MUST periodically repeat the discovery process used in the 4469 initial join for the overlay to locate an appropriate bootstrap peer, 4470 B. If an overlay has multiple mechanisms for discovery it should 4471 randomly select a method to locate a bootstrap peer. P should then 4472 send a Probe for its own Node-ID routed through B. If a response is 4473 received from a peer S', which is not P's successor, then the overlay 4474 is partitioned and P should send a Attach to S' routed through B, 4475 followed by an Update sent to S'. (Note that S' may not be in P's 4476 neighbor table once the overlay is healed, but the connection will 4477 allow S' to discover appropriate neighbor entries for itself via its 4478 own stabilization.) 4480 9.8. Route Query 4482 For this topology plugin, the RouteQueryReq contains no additional 4483 information. The RouteQueryAns contains the single node ID of the 4484 next peer to which the responding peer would have routed the request 4485 message in recursive routing: 4487 struct { 4488 NodeId next_id; 4489 } ChordRouteQueryAns; 4491 The contents of this structure are as follows: 4493 next_peer 4494 The peer to which the responding peer would route the message to 4495 in order to deliver it to the destination listed in the request. 4497 If the requester set the send_update flag, the responder SHOULD 4498 initiate an Update immediately after sending the RouteQueryAns. 4500 9.9. Leaving 4502 Peers SHOULD send a Leave request prior to exiting the Overlay 4503 Instance. Any peer which receives a Leave for a peer n in its 4504 neighbor set must remove it from the neighbor set, update its replica 4505 sets as appropriate (including Stores of data to new members of the 4506 replica set) and send Updates containing its new predecessor and 4507 successor tables. 4509 10. Enrollment and Bootstrap 4511 10.1. Overlay Configuration 4513 This specification defines a new content type "application/ 4514 p2p-overlay+xml" for an MIME entity that contains overlay 4515 information. An example document is shown below. 4517 4518 4520 4523 4525 false 4526 192.0.0.1:5678 4527 192.0.2.2:6789 4528 30 4529 false 4530 4000 4531 https://example.org 4532 foo 4533 192.0.0.3:5678 4534 300 4535 400 4536 false 4537 asecret 4538 Chord-128-2-16 4539 TODO 4540 4541 4542 single 4543 user-match 4544 1 4545 100 4546 4547 4548 array 4549 user-match 4550 22 4551 4 4552 1 4553 4554 4555 4556 TODO BASE 64 encoded signature block 4557 4559 The file MUST be a well formed XML document and it SHOULD contain an 4560 encoding declaration in the XML declaration. If the charset 4561 parameter of the MIME content type declaration is present and it is 4562 different from the encoding declaration, the charset parameter takes 4563 precedence. Every application conforming to this specification MUST 4564 accept the UTF-8 character encoding to ensure minimal 4565 interoperability. The namespace for the elements defined in this 4566 specification is urn:ietf:params:xml:ns:p2p:config-base and 4567 urn:ietf:params:xml:ns:p2p:config-chord-128-2". 4569 The file can contain multiple "configuration" elements where each one 4570 contains the configuration information for a different overlay. Each 4571 "configuration" has the following attributes: 4573 instance-name: name of the overlay 4574 expiration: time in future at which this overlay configuration is 4575 not longer valid and need to be retrieved again 4576 sequence: a monotonically increasing sequence number between 1 and 4577 65534 4579 Inside each overlay element, the following elements can occur: 4581 topology-plugin This element has an attribute called algorithm-name 4582 that describes the overlay-algorithm being used. 4583 root-cert This element contains a PEM encoded X.509v3 certificate 4584 that is the root trust store used to sign all certificates in this 4585 overlay. There can be more than one of these. 4586 required-kinds This element indicates the kinds that members must 4587 support. It has three attributes: 4588 * kind: either a string representing the kind (the name 4589 registered to IANA) or an integer kind-id allocated out of 4590 private space 4591 * max-count: the maximum number of values which members of the 4592 overlay must support. 4593 * data-model: the data model to be used. 4594 * max-size: the maximum size of individual values. 4595 * access-control: the access control model to be used. 4596 All of these values MUST be provided. If the kind is registered 4597 with IANA, the data-model and access-control attributes MUST match 4598 those in the kind registration. For instance, the example above 4599 indicates that members must support SIP-REGISTRATION with a 4600 maximum of 10 values of up to 1000 bytes each. Multiple required- 4601 kinds elements MAY be present. [TODO: we need some way to 4602 indicate iteration counters for NODE-MULTIPLE. Can some XML 4603 wizard help?] 4604 credential-server This element contains the URL at which the 4605 credential server can be reached in a "url" element. This URL 4606 MUST be of type "https:". More than one credential-server element 4607 may be present. 4608 self-signed-permitted This element indicates whether self-signed 4609 certificates are permitted. If it is set to "true", then self- 4610 signed certificates are allowed, in which case the credential- 4611 server and root-cert elements may be absent. Otherwise, it SHOULD 4612 be absent, but MAY be set "false". This element also contains an 4613 attribute "digest" which indicates the digest to be used to 4614 compute the Node-ID. Valid values for this parameter are "SHA-1" 4615 and "SHA-256". 4616 bootstrap-peer This elements represents the address of one of the 4617 bootstrap peers. It has an attribute called "address" that 4618 represents the IP address (either IPv4 or IPv6, since they can be 4619 distinguished) and an attribute called "port" that represents the 4620 port. More than one bootstrap-peer element may be present. 4621 multicast-bootstrap This element represents the address of a 4622 multicast address and port that may be used for bootstrap and that 4623 peers SHOULD listen on to enable bootstrap. It has an attributed 4624 called "address" that represents the IP address and an attribute 4625 called "port" that represents the port. More than one "multicast- 4626 bootstrap" element may be present. 4627 clients-permitted This element represents whether clients are 4628 permitted or whether all nodes must be peers. If it is set to 4629 "TRUE" or absent, this indicates that clients are permitted. If 4630 it is set to "FALSE" then nodes MUST join as peers. 4631 attach-lite-permitted This element represents whether nodes are 4632 allowed to use the AttachLite request in this overlay. If it is 4633 absent, it is treated as if it was set to "FALSE". 4634 chord-128-2-16+-update-frequency The update frequency for the 4635 Chord-128-2-16+ topology plugin (see Section 9). 4636 chord-128-2-16+-probe-frequency The probe frequency for the Chord- 4637 128-2-16+ topology plugin (see Section 9). 4638 credential-server Base URL for credential server. 4639 shared-secret If shared secret mode is used, this contains the 4640 shared secret. 4641 max-message-size Maximum size in bytes of any message in the 4642 overlay. If this value is not present, the default is 5000. 4643 initial-ttl Initial default TTL (time to live, see section XXX) for 4644 messages. If this value is not present, the default is 100. 4646 The configuration file is a binary file and can not be changed, 4647 including whitepsace changes or the signature will break. The 4648 signature is computed by taking each configuration element and 4649 starting form, and including, the first < at the start of 4650 up to and including the > in and 4651 treating this as a binary blob thats sigend using the standard 4652 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 4653 encoded using base64 alphabet from RFC[RFC4648] and put in the 4654 signature element following the configuration object in the config 4655 file. 4657 10.1.1. Relax NG Grammars 4659 The grammar for the configuration data is: 4661 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord-128-2" 4662 namespace local = "" 4663 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 4664 namespace rng = "http://relaxng.org/ns/structure/1.0" 4666 anything = 4667 (element * { anything } 4668 | attribute * { text } 4669 | text)* 4670 foreign-elements = element * - (p2pcf:* | local:* | chord:*) { anything }* 4671 hostPort = text 4672 start = 4673 element p2pcf:overlay { 4674 element configuration { 4675 attribute instance-name { text }, 4676 attribute expiration { xsd:dateTime }, 4677 attribute sequence { xsd:long }, 4678 parameter 4679 }, 4680 element signature { 4681 attribute algorithm { signature-algorithm-type }?, 4682 xsd:base64Binary 4683 }? 4684 } 4685 signature-algorithm-type |= "rsa-sha1" 4686 parameter &= element topology-plugin { topology-plugin-type } 4687 parameter &= element max-message-size { xsd:int }? 4688 parameter &= element initial-ttl { xsd:int }? 4689 parameter &= element root-cert { text }? 4690 parameter &= element required-kinds { kinds* } 4691 parameter &= element credential-server { xsd:anyURI }? 4692 parameter &= 4693 element self-signed-permitted { 4694 attribute digest { self-signed-digest-type }, 4695 xsd:boolean 4696 }? 4697 self-signed-digest-type |= "sha1" 4698 parameter &= 4699 element bootstrap-peer { hostPort 4700 }+ 4701 parameter &= 4702 element multicast-bootstrap { hostPort 4703 }* 4704 parameter &= element clients-permitted { xsd:boolean }? 4705 parameter &= element attach-lite-permitted { xsd:boolean }? 4706 parameter &= element shared-secret { xsd:string }? 4707 parameter &= foreign-elements* 4708 kinds = 4709 element kind { 4710 (attribute name { kind-names } 4711 | attribute id { xsd:int }), 4712 kind-paramter 4713 } 4714 kind-paramter &= element max-count { xsd:int } 4715 kind-paramter &= element max-size { xsd:int } 4716 kind-paramter &= element data-model { data-model-type } 4717 data-model-type |= "single" 4718 data-model-type |= "array" 4719 data-model-type |= "dictionary" 4720 kind-paramter &= element access-control { access-control-type } 4721 kind-paramter &= element max-node-muliple { xsd:int } 4722 access-control-type |= "user-match" 4723 access-control-type |= "node-match" 4724 access-control-type |= "user-node-match" 4725 access-control-type |= "node-multiple" 4726 access-control-type |= "user-match-with-anon-create" 4727 kind-paramter &= foreign-elements* 4728 # Chord specific paramters 4729 topology-plugin-type |= "Chord-128-2-16" 4730 kind-names |= "sip-registration" 4731 kind-names |= "turn-service" 4732 parameter &= element chord:update-frequency { xsd:int }? 4733 parameter &= element chord:probe-frequency { xsd:int }? 4735 10.2. Discovery Through Enrollment Server 4737 When a peer first joins a new overlay, it starts with a discovery 4738 process to find an enrollment server. Related work to the approach 4739 used here is described in [I-D.garcia-p2psip-dns-sd-bootstrapping] 4740 and [I-D.matthews-p2psip-bootstrap-mechanisms]. Another scheme for 4741 referencing overlays is described in 4742 [I-D.hardie-p2poverlay-pointers]. The peer first determines the 4743 overlay name. This value is provided by the user or some other out 4744 of band provisioning mechanism. If the name is an IP address, that 4745 is directly used otherwise the peer MUST do a DNS SRV query using a 4746 Service name of "p2p_enroll" and a protocol of tcp to find an 4747 enrollment server. 4749 Once an address for the enrollment servers is determined, the peer 4750 forms an HTTPS connection to that IP address. The certificate MUST 4751 match the overlay name as described in [RFC2818]. 4753 Whenever a peer contacts the enrollment server, it MUST fetch a new 4754 copy of the configuration file. To do this, the peer performs a GET 4755 to the URL formed by appending a path of "/p2psip/enroll" to the 4756 overlay name. For example, if the overlay name was example.com, the 4757 URL would be "https://example.com/p2psip/enroll". The result is an 4758 XML configuration file described above, which replaces any previously 4759 learned configuration file for this overlay. 4761 [[OPEN ISSUE: for unsecured overlays or overlays not specified by 4762 domain name, need to specify another way to obtain/validate certs and 4763 to update configuration info]] 4765 10.3. Credentials 4767 If the configuration document contains a credential-server element, 4768 credentials are required to join the Overlay Instance. A peer which 4769 does not yet have credentials MUST contact the credential server to 4770 acquire them. 4772 RELOAD defines its own trivial certificate request protocol. We 4773 would have liked to use an existing protocol, but were concerned 4774 about the implementation burden of even the simplest of those 4775 protocols, such as [RFC5272]) and [RFC5273]. Our objective was to 4776 have a protocol which could be easily implemented in a Web server 4777 which the operator did not control (e.g., in a hosted service) and 4778 was compatible with the existing certificate handling tooling as used 4779 with the Web certificate infrastructure. This means accepting bare 4780 PKCS#10 requests and returning a single bare X.509 certificate. 4781 Although the MIME types for these objects are defined, none of the 4782 existing protocols support exactly this model. 4784 The certificate request protocol is performed over HTTPS. The 4785 request is an HTTP POST with the following properties: 4787 o If authentication is required, there is a URL parameter of 4788 "password" containing the user's password in the clear (hence the 4789 need for HTTPS) 4790 o The body is of content type "application/pkcs10", as defined in 4791 [RFC2311]. 4792 o The Accept header contains the type "application/pkix-cert", 4793 indicating the type that is expected in the response. 4795 The credential server MUST authenticate the request using the 4796 provided user name and password. If the authentication succeeds and 4797 the requested user name is acceptable, the server and returns a 4798 certificate. The SubjectAltName field in the certificate contains 4799 the following values: 4801 o One or more Node-IDs which MUST be cryptographically random 4802 [RFC4086]. These MUST be chosen by the credential server in such 4803 a way that they are unpredictable to the requesting user. These 4804 are of type URI and MUST contain RELOAD URIs as described in 4805 Section 13.12 and MUST contain a Destination list with a single 4806 entry of type "node_id". 4807 o The names this user is allowed to use in the overlay, using type 4808 rfc822Name. 4810 The certificate is returned as type "application/pkix-cert", with an 4811 HTTP status code of 200 OK. Certificate processing errors should be 4812 treated as HTTP errors and have appropriate HTTP stats codes. [TODO: 4813 There needs to be some text here about how the interaction with other 4814 HTTP features works. This awaits the example from the apps ADs with 4815 HELD.] 4817 The client MUST check that the certificate returned was signed by one 4818 of the certificates received in the "root-cert" list of the overlay 4819 configuration data. The peer then reads the certificate to find the 4820 Node-IDs it can use. 4822 10.3.1. Self-Generated Credentials 4824 If the "self-signed-permitted" element is present and set to "TRUE", 4825 then a node MUST generate its own self-signed certificate to join the 4826 overlay. The self-signed certificate MAY contain any user name of 4827 the users choice. Users SHOULD make some attempt to make it unique 4828 but this document does not specify any mechanisms for that. 4830 The Node-ID MUST be computed by applying the digest specified in the 4831 self-signed-permitted element to the DER representation of the user's 4832 public key. When accepting a self-signed certificate, nodes MUST 4833 check that the Node-ID and public keys match. This prevents Node-ID 4834 theft. 4836 Once the node has constructed a self-signed certificate, it MAY join 4837 the overlay. Before storing its certificate in the overlay 4838 (Section 7) it SHOULD look to see if the user name is already taken 4839 and if so choose another user name. Note that this only provides 4840 protection against accidental name collisions. Name theft is still 4841 possible. If protection against name theft is desired, then the 4842 enrollment service must be used. 4844 10.4. Joining the Overlay Peer 4846 In order to join the overlay, the peer MUST contact a peer. 4847 Typically this means contacting the bootstrap peers, since they are 4848 guaranteed to have public IP addresses (the system should not 4849 advertise them as bootstrap peers otherwise). If the peer has cached 4850 peers it SHOULD contact them first by sending a Probe request to the 4851 known peer address with the destination Node-ID set to that peer's 4852 Node-ID. 4854 If no cached peers are available, then the peer SHOULD send a Probe 4855 request to the address and port found in the broadcast-peers element 4856 in the configuration document. This MAY be a multicast or anycast 4857 address. The Probe should use the wildcard Node-ID as the 4858 destination Node-ID. 4860 The responder peer that receives the Probe request SHOULD check that 4861 the overlay name is correct and that the requester peer sending the 4862 request has appropriate credentials for the overlay before responding 4863 to the Probe request even if the response is only an error. 4865 When the requester peer finally does receive a response from some 4866 responding peer, it can note the Node-ID in the response and use this 4867 Node-ID to start sending requests to join the Overlay Instance as 4868 described in Section 5.4. 4870 After a peer has successfully joined the overlay network, it SHOULD 4871 periodically look at any peers to which it has managed to form direct 4872 connections. Some of these peers MAY be added to the cached-peers 4873 list and used in future boots. Peers that are not directly connected 4874 MUST NOT be cached. The RECOMMENDED number of peers to cache is 10. 4876 11. Message Flow Example 4878 In the following example, we assume that JP has formed a connection 4879 to one of the bootstrap peers. JP then sends an Attach through that 4880 peer to the admitting peer (AP) to initiate a connection. When AP 4881 responds, JP and AP use ICE to set up a connection and then set up 4882 TLS. 4884 JP PPP PP AP NP NNP BP 4885 | | | | | | | 4886 | | | | | | | 4887 | | | | | | | 4888 |Attach Dest=JP | | | | | 4889 |---------------------------------------------------------->| 4890 | | | | | | | 4891 | | | | | | | 4892 | | |Attach Dest=JP | | | 4893 | | |<--------------------------------------| 4894 | | | | | | | 4895 | | | | | | | 4896 | | |Attach Dest=JP | | | 4897 | | |-------->| | | | 4898 | | | | | | | 4899 | | | | | | | 4900 | | |AttachAns | | | 4901 | | |<--------| | | | 4902 | | | | | | | 4903 | | | | | | | 4904 | | |AttachAns | | | 4905 | | |-------------------------------------->| 4906 | | | | | | | 4907 | | | | | | | 4908 |AttachAns | | | | | 4909 |<----------------------------------------------------------| 4910 | | | | | | | 4911 | | | | | | | 4912 |TLS | | | | | | 4913 |.............................| | | | 4914 | | | | | | | 4915 | | | | | | | 4916 | | | | | | | 4917 | | | | | | | 4919 Once JP has connected to AP, it needs to populate its Routing Table. 4920 In Chord, this means that it needs to populate its neighbor table and 4921 its finger table. To populate its neighbor table, it needs the 4922 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 4923 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 4924 to set up a connection. 4926 [[TODO: there should be a Probe here before populating]] 4927 JP PPP PP AP NP NNP BP 4928 | | | | | | | 4929 | | | | | | | 4930 | | | | | | | 4931 |Attach AP+1 | | | | | 4932 |---------------------------->| | | | 4933 | | | | | | | 4934 | | | | | | | 4935 | | | |Attach AP+1 | | 4936 | | | |-------->| | | 4937 | | | | | | | 4938 | | | | | | | 4939 | | | |AttachAns | | 4940 | | | |<--------| | | 4941 | | | | | | | 4942 | | | | | | | 4943 |AttachAns | | | | | 4944 |<----------------------------| | | | 4945 | | | | | | | 4946 | | | | | | | 4947 |Attach | | | | | | 4948 |-------------------------------------->| | | 4949 | | | | | | | 4950 | | | | | | | 4951 |TLS | | | | | | 4952 |.......................................| | | 4953 | | | | | | | 4954 | | | | | | | 4955 | | | | | | | 4956 | | | | | | | 4958 JP also needs to populate its finger table (for Chord). It issues a 4959 Attach to a variety of locations around the overlay. The diagram 4960 below shows it sending an Attach halfway around the Chord ring the JP 4961 + 2^127. 4963 JP NP XX TP 4964 | | | | 4965 | | | | 4966 | | | | 4967 |Attach JP+2<<126 | | 4968 |-------->| | | 4969 | | | | 4970 | | | | 4971 | |Attach JP+2<<126 | 4972 | |-------->| | 4973 | | | | 4974 | | | | 4975 | | |Attach JP+2<<126 4976 | | |-------->| 4977 | | | | 4978 | | | | 4979 | | |AttachAns| 4980 | | |<--------| 4981 | | | | 4982 | | | | 4983 | |AttachAns| | 4984 | |<--------| | 4985 | | | | 4986 | | | | 4987 |AttachAns| | | 4988 |<--------| | | 4989 | | | | 4990 | | | | 4991 |TLS | | | 4992 |.............................| 4993 | | | | 4994 | | | | 4995 | | | | 4996 | | | | 4998 Once JP has a reasonable set of connections he is ready to take his 4999 place in the DHT. He does this by sending a Join to AP. AP does a 5000 series of Store requests to JP to store the data that JP will be 5001 responsible for. AP then sends JP an Update explicitly labeling JP 5002 as its predecessor. At this point, JP is part of the ring and 5003 responsible for a section of the overlay. AP can now forget any data 5004 which is assigned to JP and not AP. 5006 JP PPP PP AP NP NNP BP 5007 | | | | | | | 5008 | | | | | | | 5009 | | | | | | | 5010 |JoinReq | | | | | | 5011 |---------------------------->| | | | 5012 | | | | | | | 5013 | | | | | | | 5014 |JoinAns | | | | | | 5015 |<----------------------------| | | | 5016 | | | | | | | 5017 | | | | | | | 5018 |StoreReq Data A | | | | | 5019 |<----------------------------| | | | 5020 | | | | | | | 5021 | | | | | | | 5022 |StoreAns | | | | | | 5023 |---------------------------->| | | | 5024 | | | | | | | 5025 | | | | | | | 5026 |StoreReq Data B | | | | | 5027 |<----------------------------| | | | 5028 | | | | | | | 5029 | | | | | | | 5030 |StoreAns | | | | | | 5031 |---------------------------->| | | | 5032 | | | | | | | 5033 | | | | | | | 5034 |UpdateReq| | | | | | 5035 |<----------------------------| | | | 5036 | | | | | | | 5037 | | | | | | | 5038 |UpdateAns| | | | | | 5039 |---------------------------->| | | | 5040 | | | | | | | 5041 | | | | | | | 5042 | | | | | | | 5043 | | | | | | | 5045 In Chord, JP's neighbor table needs to contain its own predecessors. 5046 It couldn't connect to them previously because Chord has no way to 5047 route immediately to your predecessors. However, now that it has 5048 received an Update from AP, it has APs predecessors, which are also 5049 its own, so it sends Attaches to them. Below it is shown connecting 5050 to its closest predecessor, PP. 5052 JP PPP PP AP NP NNP BP 5053 | | | | | | | 5054 | | | | | | | 5055 | | | | | | | 5056 |Attach Dest=PP | | | | | 5057 |---------------------------->| | | | 5058 | | | | | | | 5059 | | | | | | | 5060 | | |Attach Dest=PP | | | 5061 | | |<--------| | | | 5062 | | | | | | | 5063 | | | | | | | 5064 | | |AttachAns| | | | 5065 | | |-------->| | | | 5066 | | | | | | | 5067 | | | | | | | 5068 |AttachAns| | | | | | 5069 |<----------------------------| | | | 5070 | | | | | | | 5071 | | | | | | | 5072 |TLS | | | | | | 5073 |...................| | | | | 5074 | | | | | | | 5075 | | | | | | | 5076 |UpdateReq| | | | | | 5077 |------------------>| | | | | 5078 | | | | | | | 5079 | | | | | | | 5080 |UpdateAns| | | | | | 5081 |<------------------| | | | | 5082 | | | | | | | 5083 | | | | | | | 5084 |UpdateReq| | | | | | 5085 |---------------------------->| | | | 5086 | | | | | | | 5087 | | | | | | | 5088 |UpdateAns| | | | | | 5089 |<----------------------------| | | | 5090 | | | | | | | 5091 | | | | | | | 5092 |UpdateReq| | | | | | 5093 |-------------------------------------->| | | 5094 | | | | | | | 5095 | | | | | | | 5096 |UpdateAns| | | | | | 5097 |<--------------------------------------| | | 5098 | | | | | | | 5099 | | | | | | | 5101 Finally, now that JP has a copy of all the data and is ready to route 5102 messages and receive requests, it sends Updates to everyone in its 5103 Routing Table to tell them it is ready to go. Below, it is shown 5104 sending such an update to TP. 5106 JP NP XX TP 5107 | | | | 5108 | | | | 5109 | | | | 5110 |Update | | | 5111 |---------------------------->| 5112 | | | | 5113 | | | | 5114 |UpdateAns| | | 5115 |<----------------------------| 5116 | | | | 5117 | | | | 5118 | | | | 5119 | | | | 5121 12. Security Considerations 5123 12.1. Overview 5125 RELOAD provides a generic storage service, albeit one designed to be 5126 useful for P2PSIP. In this section we discuss security issues that 5127 are likely to be relevant to any usage of RELOAD. 5129 In any Overlay Instance, any given user depends on a number of peers 5130 with which they have no well-defined relationship except that they 5131 are fellow members of the Overlay Instance. In practice, these other 5132 nodes may be friendly, lazy, curious, or outright malicious. No 5133 security system can provide complete protection in an environment 5134 where most nodes are malicious. The goal of security in RELOAD is to 5135 provide strong security guarantees of some properties even in the 5136 face of a large number of malicious nodes and to allow the overlay to 5137 function correctly in the face of a modest number of malicious nodes. 5139 P2PSIP deployments require the ability to authenticate both peers and 5140 resources (users) without the active presence of a trusted entity in 5141 the system. We describe two mechanisms. The first mechanism is 5142 based on public key certificates and is suitable for general 5143 deployments. The second is an admission control mechanism based on 5144 an overlay-wide shared symmetric key. 5146 12.2. Attacks on P2P Overlays 5148 The two basic functions provided by overlay nodes are storage and 5149 routing: some node is responsible for storing a peer's data and for 5150 allowing a peer to fetch other peer's data. Some other set of nodes 5151 are responsible for routing messages to and from the storing nodes. 5152 Each of these issues is covered in the following sections. 5154 P2P overlays are subject to attacks by subversive nodes that may 5155 attempt to disrupt routing, corrupt or remove user registrations, or 5156 eavesdrop on signaling. The certificate-based security algorithms we 5157 describe in this draft are intended to protect overlay routing and 5158 user registration information in RELOAD messages. 5160 To protect the signaling from attackers pretending to be valid peers 5161 (or peers other than themselves), the first requirement is to ensure 5162 that all messages are received from authorized members of the 5163 overlay. For this reason, RELOAD transports all messages over a 5164 secure channel (TLS and DTLS are defined in this document) which 5165 provides message integrity and authentication of the directly 5166 communicating peer. In addition, messages and data are digitally 5167 signed with the sender's private key, providing end-to-end security 5168 for communications. 5170 12.3. Certificate-based Security 5172 This specification stores users' registrations and possibly other 5173 data in an overlay network. This requires a solution to securing 5174 this data as well as securing, as well as possible, the routing in 5175 the overlay. Both types of security are based on requiring that 5176 every entity in the system (whether user or peer) authenticate 5177 cryptographically using an asymmetric key pair tied to a certificate. 5179 When a user enrolls in the Overlay Instance, they request or are 5180 assigned a unique name, such as "alice@dht.example.net". These names 5181 are unique and are meant to be chosen and used by humans much like a 5182 SIP Address of Record (AOR) or an email address. The user is also 5183 assigned one or more Node-IDs by the central enrollment authority. 5184 Both the name and the peer ID are placed in the certificate, along 5185 with the user's public key. 5187 Each certificate enables an entity to act in two sorts of roles: 5189 o As a user, storing data at specific Resource-IDs in the Overlay 5190 Instance corresponding to the user name. 5191 o As a overlay peer with the peer ID(s) listed in the certificate. 5193 Note that since only users of this Overlay Instance need to validate 5194 a certificate, this usage does not require a global PKI. Instead, 5195 certificates are signed by require a central enrollment authority 5196 which acts as the certificate authority for the Overlay Instance. 5197 This authority signs each peer's certificate. Because each peer 5198 possesses the CA's certificate (which they receive on enrollment) 5199 they can verify the certificates of the other entities in the overlay 5200 without further communication. Because the certificates contain the 5201 user/peer's public key, communications from the user/peer can be 5202 verified in turn. 5204 If self-signed certificates are used, then the security provided is 5205 significantly decreased, since attackers can mount Sybil attacks. In 5206 addition, attackers cannot trust the user names in certificates 5207 (though they can trust the Node-IDs because they are 5208 cryptographically verifiable). This scheme is only appropriate for 5209 small deployments, such as a small office or ad hoc overlay set up 5210 among participants in a meeting. Some additional security can be 5211 provided by using the shared secret admission control scheme as well. 5213 Because all stored data is signed by the owner of the data the 5214 storing peer can verify that the storer is authorized to perform a 5215 store at that Resource-ID and also allows any consumer of the data to 5216 verify the provenance and integrity of the data when it retrieves it. 5218 All implementations MUST implement certificate-based security. 5220 12.4. Shared-Secret Security 5222 RELOAD also supports a shared secret admission control scheme that 5223 relies on a single key that is shared among all members of the 5224 overlay. It is appropriate for small groups that wish to form a 5225 private network without complexity. In shared secret mode, all the 5226 peers share a single symmetric key which is used to key TLS-PSK 5227 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 5228 key cannot form TLS connections with any other peer and therefore 5229 cannot join the overlay. 5231 One natural approach to a shared-secret scheme is to use a user- 5232 entered password as the key. The difficulty with this is that in 5233 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 5234 If passwords are used as the source of shared-keys, then TLS-SRP is a 5235 superior choice because it is not subject to dictionary attacks. 5237 12.5. Storage Security 5239 When certificate-based security is used in RELOAD, any given 5240 Resource-ID/Kind-ID pair (a slot) is bound to some small set of 5241 certificates. In order to write data in a slot, the writer must 5242 prove possession of the private key for one of those certificates. 5243 Moreover, all data is stored signed by the certificate which 5244 authorized its storage. This set of rules makes questions of 5245 authorization and data integrity - which have historically been 5246 thorny for overlays - relatively simple. 5248 12.5.1. Authorization 5250 When a client wants to store some value in a slot, it first digitally 5251 signs the value with its own private key. It then sends a Store 5252 request that contains both the value and the signature towards the 5253 storing peer (which is defined by the Resource Name construction 5254 algorithm for that particular kind of value). 5256 When the storing peer receives the request, it must determine whether 5257 the storing client is authorized to store in this slot. In order to 5258 do so, it executes the Resource Name construction algorithm for the 5259 specified kind based on the user's certificate information. It then 5260 computes the Resource-ID from the Resource Name and verifies that it 5261 matches the slot which the user is requesting to write to. If it 5262 does, the user is authorized to write to this slot, pending quota 5263 checks as described in the next section. 5265 For example, consider the certificate with the following properties: 5267 User name: alice@dht.example.com 5268 Node-ID: 013456789abcdef 5269 Serial: 1234 5271 If Alice wishes to Store a value of the "SIP Location" kind, the 5272 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 5273 Resource-ID will be determined by hashing the Resource Name. When a 5274 peer receives a request to store a record at Resource-ID X, it takes 5275 the signing certificate and recomputes the Resource Name, in this 5276 case "alice@dht.example.com". If H("alice@dht.example.com")=X then 5277 the Store is authorized. Otherwise it is not. Note that the 5278 Resource Name construction algorithm may be different for other 5279 kinds. 5281 12.5.2. Distributed Quota 5283 Being a peer in a Overlay Instance carries with it the responsibility 5284 to store data for a given region of the Overlay Instance. However, 5285 if clients were allowed to store unlimited amounts of data, this 5286 would create unacceptable burdens on peers, as well as enabling 5287 trivial denial of service attacks. RELOAD addresses this issue by 5288 requiring configurations to define maximum sizes for each kind of 5289 stored data. Attempts to store values exceeding this size MUST be 5290 rejected (if peers are inconsistent about this, then strange 5291 artifacts will happen when the zone of responsibility shifts and a 5292 different peer becomes responsible for overlarge data). Because each 5293 slot is bound to a small set of certificates, these size restrictions 5294 also create a distributed quota mechanism, with the quotas 5295 administered by the central enrollment server. 5297 Allowing different kinds of data to have different size restrictions 5298 allows new usages the flexibility to define limits that fit their 5299 needs without requiring all usages to have expansive limits. 5301 12.5.3. Correctness 5303 Because each stored value is signed, it is trivial for any retrieving 5304 peer to verify the integrity of the stored value. Some more care 5305 needs to be taken to prevent version rollback attacks. Rollback 5306 attacks on storage are prevented by the use of store times and 5307 lifetime values in each store. A lifetime represents the latest time 5308 at which the data is valid and thus limits (though does not 5309 completely prevent) the ability of the storing node to perform a 5310 rollback attack on retrievers. In order to prevent a rollback attack 5311 at the time of the Store request, we require that storage times be 5312 monotonically increasing. Storing peers MUST reject Store requests 5313 with storage times smaller than or equal to those they are currently 5314 storing. In addition, a fetching node which receives a data value 5315 with a storage time older than the result of the previous fetch knows 5316 a rollback has occurred. 5318 12.5.4. Residual Attacks 5320 The mechanisms described here provide a high degree of security, but 5321 some attacks remain possible. Most simply, it is possible for 5322 storing nodes to refuse to store a value (i.e., reject any request). 5323 In addition, a storing node can deny knowledge of values which it 5324 previously accepted. To some extent these attacks can be ameliorated 5325 by attempting to store to/retrieve from replicas, but a retrieving 5326 client does not know whether it should try this or not, since there 5327 is a cost to doing so. 5329 Although the certificate-based authentication scheme prevents a 5330 single peer from being able to forge data owned by other peers. 5331 Furthermore, although a subversive peer can refuse to return data 5332 resources for which it is responsible it cannot return forged data 5333 because it cannot provide authentication for such registrations. 5334 Therefore parallel searches for redundant registrations can mitigate 5335 most of the affects of a compromised peer. The ultimate reliability 5336 of such an overlay is a statistical question based on the replication 5337 factor and the percentage of compromised peers. 5339 In addition, when a kind is multivalued (e.g., an array data model), 5340 the storing node can return only some subset of the values, thus 5341 biasing its responses. This can be countered by using single values 5342 rather than sets, but that makes coordination between multiple 5343 storing agents much more difficult. This is a trade off that must be 5344 made when designing any usage. 5346 12.6. Routing Security 5348 Because the storage security system guarantees (within limits) the 5349 integrity of the stored data, routing security focuses on stopping 5350 the attacker from performing a DOS attack on the system by misrouting 5351 requests in the overlay. There are a few obvious observations to 5352 make about this. First, it is easy to ensure that an attacker is at 5353 least a valid peer in the Overlay Instance. Second, this is a DOS 5354 attack only. Third, if a large percentage of the peers on the 5355 Overlay Instance are controlled by the attacker, it is probably 5356 impossible to perfectly secure against this. 5358 12.6.1. Background 5360 In general, attacks on DHT routing are mounted by the attacker 5361 arranging to route traffic through or two nodes it controls. In the 5362 Eclipse attack [Eclipse] the attacker tampers with messages to and 5363 from nodes for which it is on-path with respect to a given victim 5364 node. This allows it to pretend to be all the nodes that are 5365 reachable through it. In the Sybil attack [Sybil], the attacker 5366 registers a large number of nodes and is therefore able to capture a 5367 large amount of the traffic through the DHT. 5369 Both the Eclipse and Sybil attacks require the attacker to be able to 5370 exercise control over her peer IDs. The Sybil attack requires the 5371 creation of a large number of peers. The Eclipse attack requires 5372 that the attacker be able to impersonate specific peers. In both 5373 cases, these attacks are limited by the use of centralized, 5374 certificate-based admission control. 5376 12.6.2. Admissions Control 5378 Admission to an RELOAD Overlay Instance is controlled by requiring 5379 that each peer have a certificate containing its peer ID. The 5380 requirement to have a certificate is enforced by using certificate- 5381 based mutual authentication on each connection. Thus, whenever a 5382 peer connects to another peer, each side automatically checks that 5383 the other has a suitable certificate. These peer IDs are randomly 5384 assigned by the central enrollment server. This has two benefits: 5386 o It allows the enrollment server to limit the number of peer IDs 5387 issued to any individual user. 5388 o It prevents the attacker from choosing specific peer IDs. 5390 The first property allows protection against Sybil attacks (provided 5391 the enrollment server uses strict rate limiting policies). The 5392 second property deters but does not completely prevent Eclipse 5393 attacks. Because an Eclipse attacker must impersonate peers on the 5394 other side of the attacker, he must have a certificate for suitable 5395 peer IDs, which requires him to repeatedly query the enrollment 5396 server for new certificates which only will match by chance. From 5397 the attacker's perspective, the difficulty is that if he only has a 5398 small number of certificates the region of the Overlay Instance he is 5399 impersonating appears to be very sparsely populated by comparison to 5400 the victim's local region. 5402 12.6.3. Peer Identification and Authentication 5404 In general, whenever a peer engages in overlay activity that might 5405 affect the routing table it must establish its identity. This 5406 happens in two ways. First, whenever a peer establishes a direct 5407 connection to another peer it authenticates via certificate-based 5408 mutual authentication. All messages between peers are sent over this 5409 protected channel and therefore the peers can verify the data origin 5410 of the last hop peer for requests and responses without further 5411 cryptography. 5413 In some situations, however, it is desirable to be able to establish 5414 the identity of a peer with whom one is not directly connected. The 5415 most natural case is when a peer Updates its state. At this point, 5416 other peers may need to update their view of the overlay structure, 5417 but they need to verify that the Update message came from the actual 5418 peer rather than from an attacker. To prevent this, all overlay 5419 routing messages are signed by the peer that generated them. 5421 [OPEN ISSUE: this allows for replay attacks on requests. There are 5422 two basic defenses here. The first is global clocks and loose anti- 5423 replay. The second is to refuse to take any action unless you verify 5424 the data with the relevant node. This issue is undecided.] 5426 [TODO: I think we are probably going to end up with generic 5427 signatures or at least optional signatures on all overlay messages.] 5429 12.6.4. Protecting the Signaling 5431 The goal here is to stop an attacker from knowing who is signaling 5432 what to whom. An attacker being able to observe the activities of a 5433 specific individual is unlikely given the randomization of IDs and 5434 routing based on the present peers discussed above. Furthermore, 5435 because messages can be routed using only the header information, the 5436 actual body of the RELOAD message can be encrypted during 5437 transmission. 5439 There are two lines of defense here. The first is the use of TLS or 5440 DTLS for each communications link between peers. This provides 5441 protection against attackers who are not members of the overlay. The 5442 second line of defense, if certificate-based security is used, is to 5443 digitally sign each message. This prevents adversarial peers from 5444 modifying messages in flight, even if they are on the routing path. 5446 12.6.5. Residual Attacks 5448 The routing security mechanisms in RELOAD are designed to contain 5449 rather than eliminate attacks on routing. It is still possible for 5450 an attacker to mount a variety of attacks. In particular, if an 5451 attacker is able to take up a position on the overlay routing between 5452 A and B it can make it appear as if B does not exist or is 5453 disconnected. It can also advertise false network metrics in attempt 5454 to reroute traffic. However, these are primarily DoS attacks. 5456 The certificate-based security scheme secures the namespace, but if 5457 an individual peer is compromised or if an attacker obtains a 5458 certificate from the CA, then a number of subversive peers can still 5459 appear in the overlay. While these peers cannot falsify responses to 5460 resource queries, they can respond with error messages, effecting a 5461 DoS attack on the resource registration. They can also subvert 5462 routing to other compromised peers. To defend against such attacks, 5463 a resource search must still consist of parallel searches for 5464 replicated registrations. 5466 13. IANA Considerations 5468 This section contains the new code points registered by this 5469 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 5470 the RFC number for this specification in the following list.] 5472 13.1. Port Registrations 5474 IANA has already allocated a port for the main peer to peer protocol. 5475 This port has the name p2p-sip and the port number of 6084. The 5476 names of this port may need to be changed as this draft progresses 5477 and if it does careful instructions will be needed to IANA to ensure 5478 the final RFC and IANA registrations are in sync. 5480 [[TODO - add IANA registration for p2p_enroll SRV and p2p_menroll]] 5482 13.2. Overlay Algorithm Types 5484 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 5485 Entries in this registry are strings denoting the names of overlay 5486 algorithms. The registration policy for this registry is RFC 5226 5487 IETF Review. The initial contents of this registry are: 5489 +-----------------+----------+ 5490 | Algorithm Name | RFC | 5491 +-----------------+----------+ 5492 | chord-128-2-16+ | RFC-AAAA | 5493 +-----------------+----------+ 5495 13.3. Access Control Policies 5497 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 5498 in this registry are strings denoting access control policies, as 5499 described in Section 6.3. New entries in this registry SHALL be 5500 registered via RFC 5226 IETF Review. The initial contents of this 5501 registry are: 5503 USER-MATCH 5504 NODE-MATCH 5505 USER-NODE-MATCH 5506 NODE-MULTIPLE 5507 USER-MATCH-WITH-ANONYMOUS-CREATE 5509 13.4. Data Kind-ID 5511 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 5512 registry are 32-bit integers denoting data kinds, as described in 5513 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 5514 SHALL be registered via RFC 5226 Standards Action. Code points in 5515 the range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 5516 Expert Review. Code points in the range 0xf0000001 to 0xffffffff are 5517 reserved for private use via the kind description mechanism described 5518 in Section 10. The initial contents of this registry are: 5520 +--------------------+------------+----------+ 5521 | Kind | Kind-ID | RFC | 5522 +--------------------+------------+----------+ 5523 | INVALID | 0 | RFC-AAAA | 5524 | SIP-REGISTRATION | 1 | RFC-AAAA | 5525 | TURN_SERVICE | 2 | RFC-AAAA | 5526 | CERTIFICATE | 3 | RFC-AAAA | 5527 | ROUTING_TABLE_SIZE | 4 | RFC-AAAA | 5528 | SOFTWARE_VERSION | 5 | RFC-AAAA | 5529 | MACHINE_UPTIME | 6 | RFC-AAAA | 5530 | APP_UPTIME | 7 | RFC-AAAA | 5531 | MEMORY_FOOTPRINT | 8 | RFC-AAAA | 5532 | DATASIZE_StoreD | 9 | RFC-AAAA | 5533 | INSTANCES_StoreD | 10 | RFC-AAAA | 5534 | MESSAGES_SENT_RCVD | 11 | RFC-AAAA | 5535 | EWMA_BYTES_SENT | 12 | RFC-AAAA | 5536 | EWMA_BYTES_RCVD | 13 | RFC-AAAA | 5537 | LAST_CONTACT | 14 | RFC-AAAA | 5538 | RTT | 15 | RFC-AAAA | 5539 | Reserved | 0x7fffffff | RFC-AAAA | 5540 | Reserved | 0xffffffff | RFC-AAAA | 5541 +--------------------+------------+----------+ 5543 13.5. Data Model 5545 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 5546 registry are 8-bit integers denoting data models, as described in 5547 Section 6.2. Code points in this registry SHALL be registered via 5548 RFC 5226 IETF Review. The initial contents of this registry are: 5550 +--------------+------+----------+ 5551 | Data Model | Code | RFC | 5552 +--------------+------+----------+ 5553 | INVALID | 0 | RFC-AAAA | 5554 | SINGLE_VALUE | 1 | RFC-AAAA | 5555 | ARRAY | 2 | RFC-AAAA | 5556 | DICTIONARY | 3 | RFC-AAAA | 5557 | RESERVED | 255 | RFC-AAAA | 5558 +--------------+------+----------+ 5560 13.6. Message Codes 5562 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 5563 registry are 16-bit integers denoting method codes as described in 5564 Section 5.3.3. These codes SHALL be registered via RFC 5226 5565 Standards Action. The initial contents of this registry are: 5567 +-------------------+----------------+----------+ 5568 | Message Code Name | Code Value | RFC | 5569 +-------------------+----------------+----------+ 5570 | invalid | 0 | RFC-AAAA | 5571 | probe_req | 1 | RFC-AAAA | 5572 | probe_ans | 2 | RFC-AAAA | 5573 | attach_req | 3 | RFC-AAAA | 5574 | attach_ans | 4 | RFC-AAAA | 5575 | unused | 5 | | 5576 | unused | 6 | | 5577 | store_req | 7 | RFC-AAAA | 5578 | store_ans | 8 | RFC-AAAA | 5579 | fetch_req | 9 | RFC-AAAA | 5580 | fetch_ans | 10 | RFC-AAAA | 5581 | remove_req | 11 | RFC-AAAA | 5582 | remove_ans | 12 | RFC-AAAA | 5583 | find_req | 13 | RFC-AAAA | 5584 | find_ans | 14 | RFC-AAAA | 5585 | join_req | 15 | RFC-AAAA | 5586 | join_ans | 16 | RFC-AAAA | 5587 | leave_req | 17 | RFC-AAAA | 5588 | leave_ans | 18 | RFC-AAAA | 5589 | update_req | 19 | RFC-AAAA | 5590 | update_ans | 20 | RFC-AAAA | 5591 | route_query_req | 21 | RFC-AAAA | 5592 | route_query_ans | 22 | RFC-AAAA | 5593 | ping_req | 23 | RFC-AAAA | 5594 | ping_ans | 24 | RFC-AAAA | 5595 | stat_req | 25 | RFC-AAAA | 5596 | stat_ans | 26 | RFC-AAAA | 5597 | attachlite_req | 27 | RFC-AAAA | 5598 | attachlite_ans | 28 | RFC-AAAA | 5599 | reserved | 0x8000..0xfffe | RFC-AAAA | 5600 | error | 0xffff | RFC-AAAA | 5601 +-------------------+----------------+----------+ 5603 13.7. Error Codes 5605 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 5606 registry are 16-bit integers denoting error codes. New entries SHALL 5607 be defined via RFC 5226 Standards Action. The initial contents of 5608 this registry are: 5610 +-------------------------------------+----------------+----------+ 5611 | Error Code Name | Code Value | RFC | 5612 +-------------------------------------+----------------+----------+ 5613 | invalid | 0 | RFC-AAAA | 5614 | Error_Unauthorized | 1 | RFC-AAAA | 5615 | Error_Forbidden | 2 | RFC-AAAA | 5616 | Error_Not_Found | 3 | RFC-AAAA | 5617 | Error_Request_Timeout | 4 | RFC-AAAA | 5618 | Error_Precondition_Failed | 5 | RFC-AAAA | 5619 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 5620 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 5621 | Error_Data_Too_Large | 8 | RFC-AAAA | 5622 | Error_Data_Too_Old | 9 | RFC-AAAA | 5623 | Error_TTL_Exceeded | 10 | RFC-AAAA | 5624 | Error_Message_Too_Large | 11 | RFC-AAAA | 5625 | reserved | 0x8000..0xfffe | RFC-AAAA | 5626 +-------------------------------------+----------------+----------+ 5628 13.8. Route Log Extension Types 5630 IANA SHALL create a "RELOAD Route Log Extension Type Registry." New 5631 entries SHALL be defined via RFC 5226 Specification Required. The 5632 initial contents of this registry are: 5634 +--------------------------+------+---------------+ 5635 | Route Log Extension Name | Code | Specification | 5636 +--------------------------+------+---------------+ 5637 | invalid | 0 | RFC-AAAA | 5638 | reserved | 255 | RFC-AAAA | 5639 +--------------------------+------+---------------+ 5641 13.9. Overlay Link Types 5643 IANA shall create a "RELOAD Overlay Link Type Registry." New entries 5644 SHALL be defined via RFC 5226 Standards Action. This registry SHALL 5645 be initially populated with the following values: 5647 +----------+------+---------------+ 5648 | Protocol | Code | Specification | 5649 +----------+------+---------------+ 5650 | invalid | 0 | RFC-AAAA | 5651 | tcp_tls | 1 | RFC-AAAA | 5652 | udp_dtls | 2 | RFC-AAAA | 5653 | reserved | 255 | RFC-AAAA | 5654 +----------+------+---------------+ 5656 13.10. Forwarding Options 5658 IANA shall create a "Forwarding Option Registry". Entries in this 5659 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 5660 Action. Entries in this registry between 128 and 254 SHALL be 5661 defined via RFC 5226 Specification Required. This registry SHALL be 5662 initially populated with the following values: 5664 +-------------------+------+---------------+ 5665 | Forwarding Option | Code | Specification | 5666 +-------------------+------+---------------+ 5667 | invalid | 0 | RFC-AAAA | 5668 | reserved | 255 | RFC-AAAA | 5669 +-------------------+------+---------------+ 5671 13.11. Probe Information Types 5673 IANA shall create a "RELOAD Probe Information Type Registry". 5674 Entries in this registry SHALL be defined via RFC 5226 Standards 5675 Action. This registry SHALL be initially populated with the 5676 following values: 5678 +-----------------+------+---------------+ 5679 | Probe Option | Code | Specification | 5680 +-----------------+------+---------------+ 5681 | invalid | 0 | RFC-AAAA | 5682 | responsible_set | 1 | RFC-AAAA | 5683 | requested_info | 2 | RFC-AAAA | 5684 | reserved | 255 | RFC-AAAA | 5685 +-----------------+------+---------------+ 5687 13.12. reload: URI Scheme 5689 This section describes the scheme for a reload: URI, which can be 5690 used to refer to either: 5692 o A peer. 5693 o A resource inside a peer. 5695 The reload: URI is defined using a subset of the URI schema 5696 specified in Appendix A of RFC 3986 [REF] and the associated URI 5697 Guidelines [REF: RFC4395] per the following ABNF syntax: 5699 RELOAD-URI = "reload://" destination "@" overlay "/" 5700 [specifier] 5702 destination = 1 * HEXDIG 5703 overlay = reg-name 5704 specifier = 1*HEXDIG 5706 The definitions of these productions are as follows: 5708 destination: a hex-encoded Destination List object. 5710 overlay: the name of the overlay. 5712 specifier : a hex-encoded StoredDataSpecifier indicating the data 5713 element. 5715 If no specifier is present than this URI addresses the peer which can 5716 be reached via the indicated destination list at the indicated 5717 overlay name. If a specifier is present, then the URI addresses the 5718 data value. 5720 13.12.1. URI Registration 5722 The following summarizes the information necessary to register the 5723 reload: URI. 5725 URI Scheme Name: reload 5726 Status: permanent 5727 URI Scheme Syntax: see Section 13.12. 5728 URI Scheme Semantics: The reload: URI is intended to be used as a 5729 reference to a RELOAD peer or resource. 5730 Encoding Considerations: The reload: URI is not intended to be 5731 human-readable text, therefore they are encoded entirely in US- 5732 ASCII. 5733 Applications/protocols that use this URI scheme: The RELOAD 5734 protocol described in RFC-AAAA. 5735 TBD for the rest of this template. 5737 14. Acknowledgments 5739 This draft is a merge of the "REsource LOcation And Discovery 5740 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 5741 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 5742 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 5743 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 5744 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 5745 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 5746 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 5747 Matuszewski. Thanks to the authors of RFC 5389 for text included 5748 from that. 5750 Thanks to the many people who contributed including: Michael Chen, 5751 TODO - fill in. 5753 15. References 5755 15.1. Normative References 5757 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 5758 Requirement Levels", BCP 14, RFC 2119, March 1997. 5760 [I-D.ietf-mmusic-ice] 5761 Rosenberg, J., "Interactive Connectivity Establishment 5762 (ICE): A Protocol for Network Address Translator (NAT) 5763 Traversal for Offer/Answer Protocols", 5764 draft-ietf-mmusic-ice-19 (work in progress), October 2007. 5766 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 5767 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 5768 October 2008. 5770 [I-D.ietf-behave-turn] 5771 Rosenberg, J., Mahy, R., and P. Matthews, "Traversal Using 5772 Relays around NAT (TURN): Relay Extensions to Session 5773 Traversal Utilities for NAT (STUN)", 5774 draft-ietf-behave-turn-12 (work in progress), 5775 November 2008. 5777 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 5778 (CMC): Transport Protocols", RFC 5273, June 2008. 5780 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 5781 (CMC)", RFC 5272, June 2008. 5783 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 5784 for Transport Layer Security (TLS)", RFC 4279, 5785 December 2005. 5787 [I-D.ietf-mmusic-ice-tcp] 5788 Rosenberg, J., "TCP Candidates with Interactive 5789 Connectivity Establishment (ICE)", 5790 draft-ietf-mmusic-ice-tcp-07 (work in progress), 5791 July 2008. 5793 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 5794 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 5796 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 5797 Security", RFC 4347, April 2006. 5799 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 5800 Friendly Rate Control (TFRC): Protocol Specification", 5801 RFC 5348, September 2008. 5803 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 5804 Encodings", RFC 4648, October 2006. 5806 15.2. Informative References 5808 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 5809 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 5810 April 2007. 5812 [I-D.ietf-p2psip-concepts] 5813 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 5814 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 5815 draft-ietf-p2psip-concepts-02 (work in progress), 5816 July 2008. 5818 [RFC1122] Braden, R., "Requirements for Internet Hosts - 5819 Communication Layers", STD 3, RFC 1122, October 1989. 5821 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 5822 A., Peterson, J., Sparks, R., Handley, M., and E. 5823 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 5824 June 2002. 5826 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 5827 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 5828 RFC 5382, October 2008. 5830 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 5831 the Session Description Protocol (SDP)", RFC 4145, 5832 September 2005. 5834 [RFC4571] Lazzaro, J., "Framing Real-time Transport Protocol (RTP) 5835 and RTP Control Protocol (RTCP) Packets over Connection- 5836 Oriented Transport", RFC 4571, July 2006. 5838 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 5840 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 5841 Requirements for Security", BCP 106, RFC 4086, June 2005. 5843 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 5844 "Using the Secure Remote Password (SRP) Protocol for TLS 5845 Authentication", RFC 5054, November 2007. 5847 [RFC3280] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet 5848 X.509 Public Key Infrastructure Certificate and 5849 Certificate Revocation List (CRL) Profile", RFC 3280, 5850 April 2002. 5852 [I-D.matthews-p2psip-bootstrap-mechanisms] 5853 Cooper, E., "Bootstrap Mechanisms for P2PSIP", 5854 draft-matthews-p2psip-bootstrap-mechanisms-00 (work in 5855 progress), February 2007. 5857 [I-D.garcia-p2psip-dns-sd-bootstrapping] 5858 Garcia, G., "P2PSIP bootstrapping using DNS-SD", 5859 draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in 5860 progress), October 2007. 5862 [I-D.pascual-p2psip-clients] 5863 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 5864 Yongchao, "P2PSIP Clients", 5865 draft-pascual-p2psip-clients-01 (work in progress), 5866 February 2008. 5868 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 5869 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 5870 RFC 4787, January 2007. 5872 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 5873 L. Repka, "S/MIME Version 2 Message Specification", 5874 RFC 2311, March 1998. 5876 [I-D.jiang-p2psip-sep] 5877 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 5878 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 5879 February 2008. 5881 [I-D.zheng-p2psip-diagnose] 5882 Yongchao, S. and X. Jiang, "Diagnose P2PSIP Overlay 5883 Network", draft-zheng-p2psip-diagnose-04 (work in 5884 progress), December 2008. 5886 [I-D.hardie-p2poverlay-pointers] 5887 Hardie, T., "Mechanisms for use in pointing to overlay 5888 networks, nodes, or resources", 5889 draft-hardie-p2poverlay-pointers-00 (work in progress), 5890 January 2008. 5892 [I-D.ietf-p2psip-sip] 5893 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 5894 H. Schulzrinne, "A SIP Usage for RELOAD", 5895 draft-ietf-p2psip-sip-00 (work in progress), October 2008. 5897 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 5899 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 5900 "Eclipse Attacks on Overlay Networks: Threats and 5901 Defenses", INFOCOM 2006, April 2006. 5903 [non-transitive-dhts-worlds05] 5904 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 5905 Stoica, "Non-Transitive Connectivity and DHTs", 5906 WORLDS'05. 5908 [lookups-churn-p2p06] 5909 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 5910 Improving DHT Lookup Performance under Churn", IEEE 5911 P2P'06. 5913 [bryan-design-hotp2p08] 5914 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 5915 a Versatile, Secure P2PSIP Communications Architecture for 5916 the Public Internet", Hot-P2P'08. 5918 [opendht-sigcomm05] 5919 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 5920 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 5921 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 5923 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 5924 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 5925 Scalable Peer-to-peer Lookup Protocol for Internet 5926 Applications", IEEE/ACM Transactions on Networking Volume 5927 11, Issue 1, 17-32, Feb 2003. 5929 [vulnerabilities-acsac04] 5930 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 5931 Threats in Structured Peer-to-Peer Systems: A Quantitative 5932 Analysis", ACSAC 2004. 5934 [handling-churn-usenix04] 5935 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 5936 "Handling Churn in a DHT", USENIX 2004. 5938 [minimizing-churn-sigcomm06] 5939 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 5940 in Distributed Systems", SIGCOMM 2006. 5942 Appendix A. Change Log 5944 A.1. Changes since draft-ietf-p2psip-reload-01 5946 o Added the ability to introduce new kinds dynamically. 5947 o Added configuration file updating. 5948 o Major revisions to reliability and flow control algorithms. 5949 o Moved diagnostics out--they no go in a separate draft. 5950 o Removed REMOVE: you now store a "nonexistent" element. 5952 A.2. Changes since draft-ietf-p2psip-reload-00 5954 o Split base protocol from combined draft into new draft. 5955 o Update architecture discussion to address concerns raised about 5956 clarity of roles. 5957 o Moved extensive discussion of routing and client behaviors to 5958 appendix. 5959 o Split Ping into Ping and Probe 5960 o Added AttachLite to provide way to implement ICE-Lite 5961 o added Stat call for retrieving meta-data 5962 o added discussion of periodic vs reactive recovery issue 5963 o changed finger table stabilization to prefer long-lived over best- 5964 match 5965 o updated IANA considerations to be more complete 5966 o changed error codes from http-based 5968 A.3. Changes since draft-ietf-p2psip-base-00 5970 o removed TUNNEL method 5971 o allow implementations more flexibility in picking finger table 5972 entry and revise random range 5973 o decouple overlay configuration from enrollment server 5974 o add error for data too large 5975 o change architecture to overlay perspective from previous revision 5976 and update terminology in document to match 5978 A.4. Changes since draft-ietf-p2psip-base-01 5980 o reordered message routing section to clarify that other routing 5981 algorithms are possible besides symmetric recursive. 5982 o clarified document IPR terms 5984 A.5. Changes since draft-ietf-p2psip-base-01a 5986 o Fragment offset was too small to hold 2^24 bit messages so fixed 5987 this from 16 bits to 32 bits. 5989 o Changed absolute times from seconds to milliseconds 5990 o Added error for messages over max size 5991 o Added error for TTL expired 5992 o Add time in response to PING 5993 o Clarified retransmission and fragmentation algorithm 5994 o Clarified acknowledgement tracking for congestion control 5996 Appendix B. Routing Alternatives 5998 Significant discussion has been focused on the selection of a routing 5999 algorithm for P2PSIP. This section discusses the motivations for 6000 selection of symmetric recursive routing for RELOAD and describes the 6001 extensions that would be required to support additional routing 6002 algorithms. 6004 B.1. Iterative vs Recursive 6006 Iterative routing has a number of advantages. It is easier to debug, 6007 consumes fewer resources on intermediate peers, and allows the 6008 querying peer to identify and route around misbehaving peers 6009 [non-transitive-dhts-worlds05]. However, in the presence of NATs 6010 iterative routing is intolerably expensive because a new connection 6011 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 6013 Iterative routing is supported through the Route_Query mechanism and 6014 is primarily intended for debugging. It is also allows the querying 6015 peer to evaluate the routing decisions made by the peers at each hop, 6016 consider alternatives, and perhaps detect at what point the 6017 forwarding path fails. 6019 B.2. Symmetric vs Forward response 6021 An alternative to the symmetric recursive routing method used by 6022 RELOAD is Forward-Only routing, where the response is routed to the 6023 requester as if it is a new message initiating by the responder (in 6024 the previous example, Z sends the response to A as if it were sending 6025 a request). Forward-only routing requires no state in either the 6026 message or intermediate peers. 6028 The drawback of forward-only routing is that it does not work when 6029 the overlay is unstable. For example, if A is in the process of 6030 joining the overlay and is sending a Join request to Z, it is not yet 6031 reachable via forward routing. Even if it is established in the 6032 overlay, if network failures produce temporary instability, A may not 6033 be reachable (and may be trying to stabilize its network connectivity 6034 via Attach messages). 6036 Furthermore, forward-only responses are less likely to reach the 6037 querying peer than symmetric recursive because the forward path is 6038 more likely to have a failed peer than the request path (which was 6039 just tested to route the request) [non-transitive-dhts-worlds05]. 6041 An extension to RELOAD that supports forward-only routing but relies 6042 on symmetric responses as a fallback would be possible, but due to 6043 the complexities of determining when to use forward-only and when to 6044 fallback to symmetric, we have chosen not to include it as an option 6045 at this point. 6047 B.3. Direct Response 6049 Another routing option is Direct Response routing, in which the 6050 response is returned directly to the querying node. In the previous 6051 example, if A encodes its IP address in the request, then Z can 6052 simply deliver the response directly to A. In the absence of NATs or 6053 other connectivity issues, this is the optimal routing technique. 6055 The challenge of implementing direct response is the presence of 6056 NATs. There are a number of complexities that must be addressed. In 6057 this discussion, we will continue our assumption that A issued the 6058 request and Z is generating the response. 6060 o The IP address listed by A may be unreachable, either due to NAT 6061 or firewall rules. Therefore, a direct response technique must 6062 fallback to symmetric response [non-transitive-dhts-worlds05]. 6063 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 6064 received the message (and the TLS negotiation will provide earlier 6065 confirmation that A is reachable), but this fallback requires a 6066 timeout that will increase the response latency whenever A is not 6067 reachable from Z. 6068 o Whenever A is behind a NAT it will have multiple candidate IP 6069 addresses, each of which must be advertised to ensure 6070 connectivity, therefore Z will need to attempt multiple 6071 connections to deliver the response. 6072 o One (or all) of A's candidate addresses may route from Z to a 6073 different device on the Internet. In the worst case these nodes 6074 may actually be running RELOAD on the same port. Therefore, 6075 establishing a secure connection to authenticate A before 6076 delivering the response is absolutely necessary. This step 6077 diminishes the efficiency of direct response because multiple 6078 roundtrips are required before the message can be delivered. 6079 o If A is behind a NAT and does not have a connection already 6080 established with Z, there are only two ways the direct response 6081 will work. The first is that A and Z are both behind the same 6082 NAT, in which case the NAT is not involved. In the more common 6083 case, when Z is outside A's NAT, the response will only be 6084 received if A's NAT implements endpoint-independent filtering. As 6085 the choice of filtering mode conflates application transparency 6086 with security [RFC4787], and no clear recommendation is available, 6087 the prevalence of this feature in future devices remains unclear. 6089 An extension to RELOAD that supports direct response routing but 6090 relies on symmetric responses as a fallback would be possible, but 6091 due to the complexities of determining when to use direct response 6092 and when to fallback to symmetric, and the reduced performance for 6093 responses to peers behind restrictive NATs, we have chosen not to 6094 include it as an option at this point. 6096 B.4. Relay Peers 6098 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 6099 response by having A identify a peer, Q, that will be directly 6100 reachable by any other peer. A uses Attach to establish a connection 6101 with Q and advertises Q's IP address in the request sent to Z. Z 6102 sends the response to Q, which relays it to A. This then reduces the 6103 latency to two hops, plus Z negotiating a secure connection to Q. 6105 This technique relies on the relative population of nodes such as A 6106 that require relay peers and peers such as Q that are capable of 6107 serving as a relay peer. It also requires nodes to be able to 6108 identify which category they are in. This identification problem has 6109 turned out to be hard to solve and is still an open area of 6110 exploration. 6112 An extension to RELOAD that supports relay peers is possible, but due 6113 to the complexities of implementing such an alternative, we have not 6114 added such a feature to RELOAD at this point. 6116 A concept similar to relay peers, essentially choosing a relay peer 6117 at random, has previously been suggested to solve problems of 6118 pairwise non-transitivity [non-transitive-dhts-worlds05], but 6119 deterministic filtering provided by NATs make random relay peers no 6120 more likely to work than the responding peer. 6122 B.5. Symmetric Route Stability 6124 A common concern about symmetric recursive routing has been that one 6125 or more peers along the request path may fail before the response is 6126 received. The significance of this problem essentially depends on 6127 the response latency of the overlay. An overlay that produces slow 6128 responses will be vulnerable to churn, whereas responses that are 6129 delivered very quickly are vulnerable only to failures that occur 6130 over that small interval. 6132 The other aspect of this issue is whether the request itself can be 6133 successfully delivered. Assuming typical connection maintenance 6134 intervals, the time period between the last maintenance and the 6135 request being sent will be orders of magnitude greater than the delay 6136 between the request being forwarded and the response being received. 6137 Therefore, if the path was stable enough to be available to route the 6138 request, it is almost certainly going to remain available to route 6139 the response. 6141 An overlay that is unstable enough to suffer this type of failure 6142 frequently is unlikely to be able to support reliable functionality 6143 regardless of the routing mechanism. However, regardless of the 6144 stability of the return path, studies show that in the event of high 6145 churn, iterative routing is a better solution to ensure request 6146 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 6148 Finally, because RELOAD retries the end-to-end request, that retry 6149 will address the issues of churn that remain. 6151 Appendix C. Why Clients? 6153 There are a wide variety of reasons a node may act as a client rather 6154 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 6155 some of those scenarios and how the client's behavior changes based 6156 on its capabilities. 6158 C.1. Why Not Only Peers? 6160 For a number of reasons, a particular node may be forced to act as a 6161 client even though it is willing to act as a peer. These include: 6163 o The node does not have appropriate network connectivity, typically 6164 because it has a low-bandwidth network connection. 6165 o The node may not have sufficient resources, such as computing 6166 power, storage space, or battery power. 6167 o The overlay algorithm may dictate specific requirements for peer 6168 selection. These may include participation in the overlay to 6169 determine trustworthiness, control the number of peers in the 6170 overlay to reduce overly-long routing paths, or ensure minimum 6171 application uptime before a node can join as a peer. 6173 The ultimate criteria for a node to become a peer are determined by 6174 the overlay algorithm and specific deployment. A node acting as a 6175 client that has a full implementation of RELOAD and the appropriate 6176 overlay algorithm is capable of locating its responsible peer in the 6177 overlay and using CONNECT to establish a direct connection to that 6178 peer. In that way, it may elect to be reachable under either of the 6179 routing approaches listed above. Particularly for overlay algorithms 6180 that elect nodes to serve as peers based on trustworthiness or 6181 population, the overlay algorithm may require such a client to locate 6182 itself at a particular place in the overlay. 6184 C.2. Clients as Application-Level Agents 6186 SIP defines an extensive protocol for registration and security 6187 between a client and its registrar/proxy server(s). Any SIP device 6188 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 6189 peer that implements the server-side functionality required by the 6190 SIP protocol. In this case, the peer would be acting as if it were 6191 the user's peer, and would need the appropriate credentials for that 6192 user. 6194 Application-level support for clients is defined by a usage. A usage 6195 offering support for application-level clients should specify how the 6196 security of the system is maintained when the data is moved between 6197 the application and RELOAD layers. 6199 Authors' Addresses 6201 Cullen Jennings 6202 Cisco 6203 170 West Tasman Drive 6204 MS: SJC-21/2 6205 San Jose, CA 95134 6206 USA 6208 Phone: +1 408 421-9990 6209 Email: fluffy@cisco.com 6211 Bruce B. Lowekamp (editor) 6212 unaffiliated 6213 2790 Linden Ln 6214 Williamsburg, VA 23185 6215 USA 6217 Email: bbl@lowekamp.net 6218 Eric Rescorla 6219 Network Resonance 6220 2064 Edgewood Drive 6221 Palo Alto, CA 94303 6222 USA 6224 Phone: +1 650 320-8549 6225 Email: ekr@networkresonance.com 6227 Salman A. Baset 6228 Columbia University 6229 1214 Amsterdam Avenue 6230 New York, NY 6231 USA 6233 Email: salman@cs.columbia.edu 6235 Henning Schulzrinne 6236 Columbia University 6237 1214 Amsterdam Avenue 6238 New York, NY 6239 USA 6241 Email: hgs@cs.columbia.edu