idnits 2.17.1 draft-ietf-p2psip-base-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 21. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 5859. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 5870. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 5877. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 5883. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 1724 has weird spacing: '...Options optio...' == Line 2145 has weird spacing: '...tyValue ide...' == Line 2371 has weird spacing: '...ionType typ...' == Line 3344 has weird spacing: '...naryKey key...' == Line 3516 has weird spacing: '...tryMeta dict...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (December 12, 2008) is 5611 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 1625 == Missing Reference: 'TODO REF' is mentioned on line 2796, but not defined == Missing Reference: 'REF' is mentioned on line 5333, but not defined ** 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 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 (-04) exists of draft-zheng-p2psip-diagnose-03 == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-00 Summary: 3 errors (**), 0 flaws (~~), 13 warnings (==), 12 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: June 15, 2009 unaffiliated 6 E. Rescorla 7 Network Resonance 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 December 12, 2008 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-01 16 Status of this Memo 18 By submitting this Internet-Draft, each author represents that any 19 applicable patent or other IPR claims of which he or she is aware 20 have been or will be disclosed, and any of which he or she becomes 21 aware will be disclosed, in accordance with Section 6 of BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF), its areas, and its working groups. Note that 25 other groups may also distribute working documents as Internet- 26 Drafts. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 The list of current Internet-Drafts can be accessed at 34 http://www.ietf.org/ietf/1id-abstracts.txt. 36 The list of Internet-Draft Shadow Directories can be accessed at 37 http://www.ietf.org/shadow.html. 39 This Internet-Draft will expire on June 15, 2009. 41 Abstract 43 This document defines REsource LOcation And Discovery (RELOAD), a 44 peer-to-peer (P2P) signaling protocol for use on the Internet. A P2P 45 signaling protocol provides its clients with an abstract storage and 46 messaging service between a set of cooperating peers that form the 47 overlay network. RELOAD is designed to support a P2P Session 48 Initiation Protocol (P2PSIP) network, but can be utilized by other 49 applications with similar requirements by defining new usages that 50 specify the kinds of data that must be stored for a particular 51 application. RELOAD defines a security model based on a certificate 52 enrollment service that provides unique identities. NAT traversal is 53 a fundamental service of the protocol. RELOAD also allows access 54 from "client" nodes that do not need to route traffic or store data 55 for others. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 60 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 8 61 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 9 62 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 12 63 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 13 64 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 13 65 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 14 66 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 67 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 15 68 1.4. Structure of This Document . . . . . . . . . . . . . . . 16 69 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 16 70 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 18 71 3.1. Security and Identification . . . . . . . . . . . . . . 18 72 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 20 73 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 20 74 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 20 75 3.2.2. Minimum Functionality Requirements for Clients . . . 21 76 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 21 77 3.4. Connectivity Management . . . . . . . . . . . . . . . . 24 78 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 25 79 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 25 80 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 25 81 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 27 82 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 27 83 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 27 84 4. Application Support Overview . . . . . . . . . . . . . . . . 27 85 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 28 86 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 29 87 4.1.2. Usages . . . . . . . . . . . . . . . . . . . . . . . 30 88 4.1.3. Replication . . . . . . . . . . . . . . . . . . . . 30 89 4.2. Service Discovery . . . . . . . . . . . . . . . . . . . 31 90 4.3. Application Connectivity . . . . . . . . . . . . . . . . 31 91 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 31 92 5.1. Message Routing . . . . . . . . . . . . . . . . . . . . 32 93 5.1.1. Request Origination . . . . . . . . . . . . . . . . 32 94 5.1.2. Message Receipt and Forwarding . . . . . . . . . . . 33 95 5.1.2.1. Responsible ID . . . . . . . . . . . . . . . . . 33 96 5.1.2.2. Other ID . . . . . . . . . . . . . . . . . . . . 34 97 5.1.2.3. Private ID . . . . . . . . . . . . . . . . . . . 35 98 5.1.3. Response Origination . . . . . . . . . . . . . . . . 35 99 5.2. Message Structure . . . . . . . . . . . . . . . . . . . 35 100 5.2.1. Presentation Language . . . . . . . . . . . . . . . 36 101 5.2.1.1. Common Definitions . . . . . . . . . . . . . . . 37 102 5.2.2. Forwarding Header . . . . . . . . . . . . . . . . . 39 103 5.2.2.1. Destination and Via Lists . . . . . . . . . . . . 41 104 5.2.2.2. Route Logging . . . . . . . . . . . . . . . . . . 43 105 5.2.2.3. Forwarding Options . . . . . . . . . . . . . . . 45 106 5.2.3. Message Contents Format . . . . . . . . . . . . . . 46 107 5.2.3.1. Response Codes and Response Errors . . . . . . . 47 108 5.2.4. Signature . . . . . . . . . . . . . . . . . . . . . 48 109 5.3. Overlay Topology . . . . . . . . . . . . . . . . . . . . 50 110 5.3.1. Topology Plugin Requirements . . . . . . . . . . . . 50 111 5.3.2. Methods and types for use by topology plugins . . . 50 112 5.3.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 51 113 5.3.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 51 114 5.3.2.3. Update . . . . . . . . . . . . . . . . . . . . . 52 115 5.3.2.4. Route_Query . . . . . . . . . . . . . . . . . . . 52 116 5.3.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 53 117 5.4. Forwarding and Link Management Layer . . . . . . . . . . 55 118 5.4.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 55 119 5.4.1.1. Request Definition . . . . . . . . . . . . . . . 56 120 5.4.1.2. Response Definition . . . . . . . . . . . . . . . 57 121 5.4.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 57 122 5.4.1.4. Collecting STUN Servers . . . . . . . . . . . . . 57 123 5.4.1.5. Gathering Candidates . . . . . . . . . . . . . . 58 124 5.4.1.6. Encoding the Attach Message . . . . . . . . . . . 58 125 5.4.1.7. Verifying ICE Support . . . . . . . . . . . . . . 59 126 5.4.1.8. Role Determination . . . . . . . . . . . . . . . 59 127 5.4.1.9. Connectivity Checks . . . . . . . . . . . . . . . 59 128 5.4.1.10. Concluding ICE . . . . . . . . . . . . . . . . . 59 129 5.4.1.11. Subsequent Offers and Answers . . . . . . . . . . 60 130 5.4.1.12. Media Keepalives . . . . . . . . . . . . . . . . 60 131 5.4.1.13. Sending Media . . . . . . . . . . . . . . . . . . 60 132 5.4.1.14. Receiving Media . . . . . . . . . . . . . . . . . 60 133 5.4.2. AttachLite . . . . . . . . . . . . . . . . . . . . . 61 134 5.4.2.1. Request Definition . . . . . . . . . . . . . . . 61 135 5.4.2.2. Attach-Lite Connectivity Checks . . . . . . . . . 62 136 5.4.2.3. Implementation Notes for Attach-Lite . . . . . . 62 137 5.4.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 62 138 5.4.3.1. Request Definition . . . . . . . . . . . . . . . 63 139 5.4.3.2. Response Definition . . . . . . . . . . . . . . . 63 140 5.5. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 63 141 5.5.1. Future Support for HIP . . . . . . . . . . . . . . . 63 142 5.5.2. Reliability for Unreliable Links . . . . . . . . . . 64 143 5.5.2.1. Framed Message Format . . . . . . . . . . . . . . 64 144 5.5.2.2. Retransmission and Flow Control . . . . . . . . . 65 145 5.5.3. Fragmentation and Reassembly . . . . . . . . . . . . 66 146 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 66 147 6.1. Data Signature Computation . . . . . . . . . . . . . . . 67 148 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 68 149 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 69 150 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 70 151 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 70 152 6.3. Data Storage Methods . . . . . . . . . . . . . . . . . . 71 153 6.3.1. Store . . . . . . . . . . . . . . . . . . . . . . . 71 154 6.3.1.1. Request Definition . . . . . . . . . . . . . . . 71 155 6.3.1.2. Response Definition . . . . . . . . . . . . . . . 74 156 6.3.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 75 157 6.3.2.1. Request Definition . . . . . . . . . . . . . . . 76 158 6.3.2.2. Response Definition . . . . . . . . . . . . . . . 78 159 6.3.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 79 160 6.3.3.1. Request Definition . . . . . . . . . . . . . . . 79 161 6.3.3.2. Response Definition . . . . . . . . . . . . . . . 79 162 6.3.4. Remove . . . . . . . . . . . . . . . . . . . . . . . 81 163 6.3.4.1. Single Value . . . . . . . . . . . . . . . . . . 82 164 6.3.4.2. Array . . . . . . . . . . . . . . . . . . . . . . 82 165 6.3.4.3. Dictionary . . . . . . . . . . . . . . . . . . . 82 166 6.3.4.4. Response Definition . . . . . . . . . . . . . . . 82 167 6.3.5. Find . . . . . . . . . . . . . . . . . . . . . . . . 82 168 6.3.5.1. Request Definition . . . . . . . . . . . . . . . 83 169 6.3.5.2. Response Definition . . . . . . . . . . . . . . . 83 170 6.3.6. Defining New Kinds . . . . . . . . . . . . . . . . . 84 171 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 84 172 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 85 173 9. Diagnostic Usage . . . . . . . . . . . . . . . . . . . . . . 86 174 9.1. Diagnostic Metrics for a P2PSIP Deployment . . . . . . . 88 175 10. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 88 176 10.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 89 177 10.2. Reactive vs Periodic Recovery . . . . . . . . . . . . . 89 178 10.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 90 179 10.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 90 180 10.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 91 181 10.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 91 182 10.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 92 183 10.7.1. Sending Updates . . . . . . . . . . . . . . . . . . 93 184 10.7.2. Receiving Updates . . . . . . . . . . . . . . . . . 94 185 10.7.3. Stabilization . . . . . . . . . . . . . . . . . . . 95 186 10.8. Route Query . . . . . . . . . . . . . . . . . . . . . . 96 187 10.9. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 97 188 11. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 97 189 11.1. Overlay Configuration . . . . . . . . . . . . . . . . . 97 190 11.2. Discovery Through Enrollment Server . . . . . . . . . . 99 191 11.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 100 192 11.3.1. Self-Generated Credentials . . . . . . . . . . . . . 101 193 11.4. Joining the Overlay Peer . . . . . . . . . . . . . . . . 101 194 12. Message Flow Example . . . . . . . . . . . . . . . . . . . . 102 195 13. Security Considerations . . . . . . . . . . . . . . . . . . . 107 196 13.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 107 197 13.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 108 198 13.3. Certificate-based Security . . . . . . . . . . . . . . . 108 199 13.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 109 200 13.5. Storage Security . . . . . . . . . . . . . . . . . . . . 109 201 13.5.1. Authorization . . . . . . . . . . . . . . . . . . . 110 202 13.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 110 203 13.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 111 204 13.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 111 205 13.6. Routing Security . . . . . . . . . . . . . . . . . . . . 112 206 13.6.1. Background . . . . . . . . . . . . . . . . . . . . . 112 207 13.6.2. Admissions Control . . . . . . . . . . . . . . . . . 112 208 13.6.3. Peer Identification and Authentication . . . . . . . 113 209 13.6.4. Protecting the Signaling . . . . . . . . . . . . . . 113 210 13.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 114 211 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 114 212 14.1. Overlay Algorithm Types . . . . . . . . . . . . . . . . 114 213 14.2. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 115 214 14.3. Data Model . . . . . . . . . . . . . . . . . . . . . . . 115 215 14.4. Message Codes . . . . . . . . . . . . . . . . . . . . . 116 216 14.5. Error Codes . . . . . . . . . . . . . . . . . . . . . . 117 217 14.6. Route Log Extension Types . . . . . . . . . . . . . . . 118 218 14.7. Overlay Link Types . . . . . . . . . . . . . . . . . . . 118 219 14.8. Forwarding Options . . . . . . . . . . . . . . . . . . . 119 220 14.9. Probe Information Types . . . . . . . . . . . . . . . . 119 221 14.10. reload: URI Scheme . . . . . . . . . . . . . . . . . . . 119 222 14.10.1. URI Registration . . . . . . . . . . . . . . . . . . 120 223 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 120 224 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 121 225 16.1. Normative References . . . . . . . . . . . . . . . . . . 121 226 16.2. Informative References . . . . . . . . . . . . . . . . . 122 227 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 124 228 A.1. Changes since draft-ietf-p2psip-reload-00 . . . . . . . 124 229 A.2. Changes since draft-ietf-p2psip-base-00 . . . . . . . . 125 230 Appendix B. Routing Alternatives . . . . . . . . . . . . . . . . 125 231 B.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 125 232 B.2. Symmetric vs Forward response . . . . . . . . . . . . . 126 233 B.3. Direct Response . . . . . . . . . . . . . . . . . . . . 126 234 B.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 127 235 B.5. Symmetric Route Stability . . . . . . . . . . . . . . . 128 236 Appendix C. Why Clients? . . . . . . . . . . . . . . . . . . . . 128 237 C.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 128 238 C.2. Clients as Application-Level Agents . . . . . . . . . . 129 239 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 129 240 Intellectual Property and Copyright Statements . . . . . . . . . 132 242 1. Introduction 244 This document defines REsource LOcation And Discovery (RELOAD), a 245 peer-to-peer (P2P) signaling protocol for use on the Internet. It 246 provides a generic, self-organizing overlay network service, allowing 247 nodes to efficiently route messages to other nodes and to efficiently 248 store and retrieve data in the overlay. RELOAD provides several 249 features that are critical for a successful P2P protocol for the 250 Internet: 252 Security Framework: A P2P network will often be established among a 253 set of peers that do not trust each other. RELOAD leverages a 254 central enrollment server to provide credentials for each peer 255 which can then be used to authenticate each operation. This 256 greatly reduces the possible attack surface. 258 Usage Model: RELOAD is designed to support a variety of 259 applications, including P2P multimedia communications with the 260 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 261 the definition of new application usages, each of which can define 262 its own data types, along with the rules for their use. This 263 allows RELOAD to be used with new applications through a simple 264 documentation process that supplies the details for each 265 application. 267 NAT Traversal: RELOAD is designed to function in environments where 268 many if not most of the nodes are behind NATs or firewalls. 269 Operations for NAT traversal are part of the base design, 270 including using ICE to establish new RELOAD or application 271 protocol connections. 273 High Performance Routing: The very nature of overlay algorithms 274 introduces a requirement that peers participating in the P2P 275 network route requests on behalf of other peers in the network. 276 This introduces a load on those other peers, in the form of 277 bandwidth and processing power. RELOAD has been defined with a 278 simple, lightweight forwarding header, thus minimizing the amount 279 of effort required by intermediate peers. 281 Pluggable Overlay Algorithms: RELOAD has been designed with an 282 abstract interface to the overlay layer to simplify implementing a 283 variety of structured (DHT) and unstructured overlay algorithms. 284 This specification also defines how RELOAD is used with Chord, 285 which is mandatory to implement. Specifying a default "must 286 implement" overlay algorithm will allow interoperability, while 287 the extensibility allows selection of overlay algorithms optimized 288 for a particular application. 290 These properties were designed specifically to meet the requirements 291 for a P2P protocol to support SIP. This document defines the base 292 protocol for the distributed storage and location service, as well as 293 critical usages for NAT traversal and security. The SIP Usage itself 294 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 295 limited to usage by SIP and could serve as a tool for supporting 296 other P2P applications with similar needs. RELOAD is also based on 297 the concepts introduced in [I-D.ietf-p2psip-concepts]. 299 1.1. Basic Setting 301 In this section, we provide a brief overview of the operational 302 setting for RELOAD. See the concepts document for more details. A 303 RELOAD Overlay Instance consists of a set of nodes arranged in a 304 partly connected graph. Each node in the overlay is assigned a 305 numeric Node-ID which, together with the specific overlay algorithm 306 in use, determines its position in the graph and the set of nodes it 307 connects to. The figure below shows a trivial example which isn't 308 drawn from any particular overlay algorithm, but was chosen for 309 convenience of representation. 311 +--------+ +--------+ +--------+ 312 | Node 10|--------------| Node 20|--------------| Node 30| 313 +--------+ +--------+ +--------+ 314 | | | 315 | | | 316 +--------+ +--------+ +--------+ 317 | Node 40|--------------| Node 50|--------------| Node 60| 318 +--------+ +--------+ +--------+ 319 | | | 320 | | | 321 +--------+ +--------+ +--------+ 322 | Node 70|--------------| Node 80|--------------| Node 90| 323 +--------+ +--------+ +--------+ 324 | 325 | 326 +--------+ 327 | Node 85| 328 |(Client)| 329 +--------+ 331 Because the graph is not fully connected, when a node wants to send a 332 message to another node, it may need to route it through the network. 333 For instance, Node 10 can talk directly to nodes 20 and 40, but not 334 to Node 70. In order to send a message to Node 70, it would first 335 send it to Node 40 with instructions to pass it along to Node 70. 336 Different overlay algorithms will have different connectivity graphs, 337 but the general idea behind all of them is to allow any node in the 338 graph to efficiently reach every other node within a small number of 339 hops. 341 The RELOAD network is not only a messaging network. It is also a 342 storage network. Records are stored under numeric addresses which 343 occupy the same space as node identifiers. Nodes are responsible for 344 storing the data associated with some set of addresses as determined 345 by their Node-ID. For instance, we might say that every node is 346 responsible for storing any data value which has an address less than 347 or equal to its own Node-ID, but greater than the next lowest 348 Node-ID. Thus, Node-20 would be responsible for storing values 349 11-20. 351 RELOAD also supports clients. These are nodes which have Node-IDs 352 but do not participate in routing or storage. For instance, in the 353 figure above Node 85 is a client. It can route to the rest of the 354 RELOAD network via Node 80, but no other node will route through it 355 and Node 90 is still responsible for all addresses between 81-90. We 356 refer to non-client nodes as peers. 358 Other applications (for instance, SIP) can be defined on top of 359 RELOAD and use these two basic RELOAD services to provide their own 360 services. 362 1.2. Architecture 364 RELOAD is fundamentally an overlay network. Therefore, it can be 365 divided into components that mimic the layering of the Internet 366 model[RFC1122]. 368 Application 370 +-------+ +-------+ 371 | SIP | | XMPP | ... 372 | Usage | | Usage | 373 +-------+ +-------+ 374 -------------------------------------- Messaging API 375 +------------------+ +---------+ 376 | Message |<--->| Storage | 377 | Transport | +---------+ 378 +------------------+ ^ 379 ^ ^ | 380 | v v 381 | +-------------------+ 382 | | Topology | 383 | | Plugin | 384 | +-------------------+ 385 | ^ 386 v v 387 +------------------+ 388 | Forwarding & | 389 | Link Management | 390 +------------------+ 391 -------------------------------------- Overlay Link API 392 +-------+ +------+ 393 |TLS | |DTLS | ... 394 +-------+ +------+ 396 The major components of RELOAD are: 398 Usage Layer: Each application defines a RELOAD usage; a set of data 399 kinds and behaviors which describe how to use the services 400 provided by RELOAD. These usages all talk to RELOAD through a 401 common Message Transport API. 403 Message Transport: Handles the end-to-end reliability, manages 404 request state for the usages, and forwards Store and Fetch 405 operations to the Storage component. Delivers message responses 406 to the component initiating the request. 408 Storage: The Storage component is responsible for processing 409 messages relating to the storage and retrieval of data. It talks 410 directly to the Topology Plugin to manage data replication and 411 migration, and it talks to the Message Transport to send and 412 receive messages. 414 Topology Plugin: The Topology Plugin is responsible for implementing 415 the specific overlay algorithm being used. It uses the Message 416 Transport component to send and receive overlay management 417 messages, to the Storage component to manage data replication, and 418 directly to the Forwarding Layer to control hop-by-hop message 419 forwarding. This component closely parallels conventional routing 420 algorithms, but is more tightly coupled to the Forwarding Layer 421 because there is no single "routing table" equivalent used by all 422 overlay algorithms. 424 Forwarding and Link Management Layer: Stores and implements the 425 routing table by providing packet forwarding services between 426 nodes. It also handles establishing new links between nodes, 427 including setting up connections across NATs using ICE. 429 Overlay Link Layer: TLS and DTLS are the "link layer" protocols used 430 by RELOAD for hop-by-hop communication. Each such protocol 431 includes the appropriate provisions for per-hop framing or hop-by- 432 hop ACKs required by unreliable transports. 434 To further clarify the roles of the various layer, this figure 435 parallels the architecture with each layer's role from an overlay 436 perspective and implementation layer in the internet: 438 | Internet Model | 439 Real | Equivalent | Reload 440 Internet | in Overlay | Architecture 441 ---------------+-----------------+------------------------------------ 442 | | +-------+ +-------+ 443 | Application | | SIP | | XMPP | ... 444 | | | Usage | | Usage | 445 | | +-------+ +-------+ 446 | | ---------------------------------- 447 | |+------------------+ +---------+ 448 | Transport || Message |<--->| Storage | 449 | || Transport | +---------+ 450 | |+------------------+ ^ 451 | | ^ ^ | 452 | | | v v 453 Application | | | +-------------------+ 454 | (Routing) | | | Topology | 455 | | | | Plugin | 456 | | | +-------------------+ 457 | | v ^ 458 | | v 459 | Network | +------------------+ 460 | | | Forwarding & | 461 | | | Link Management | 462 | | +------------------+ 463 | | ---------------------------------- 464 Transport | Link | +-------+ +------+ 465 | | |TLS | |DTLS | ... 466 | | +-------+ +------+ 467 ----------------+-----------------+------------------------------------ 468 Network | 469 | 470 Link | 472 1.2.1. Usage Layer 474 The top layer, called the Usage Layer, has application usages, such 475 as the SIP Location Usage, that use the abstract Message Transport 476 API provided by RELOAD. The goal of this layer is to implement 477 application-specific usages of the generic overlay services provided 478 by RELOAD. The usage defines how a specific application maps its 479 data into something that can be stored in the overlay, where to store 480 the data, how to secure the data, and finally how applications can 481 retrieve and use the data. 483 The architecture diagram shows both a SIP usage and an XMPP usage. A 484 single application may require multiple usages, for example a SIP 485 application may also require a voicemail usage. A usage may define 486 multiple kinds of data that are stored in the overlay and may also 487 rely on kinds originally defined by other usages. 489 Because the security and storage policies for each kind are dictated 490 by the usage defining the kind, the usages may be coupled with the 491 Storage component to provide security policy enforcement and to 492 implement appropriate storage strategies according to the needs of 493 the usage. The exact implementation of such an interface is outside 494 the scope of this draft. 496 This draft also defines a Diagnostics Usage, which can be used to 497 obtain diagnostic information about a peer in the overlay. The 498 Diagnostics Usage is interesting both to administrators monitoring 499 the overlay as well as to some overlay algorithms that base their 500 decisions on capabilities and current load of nodes in the overlay. 502 1.2.2. Message Transport 504 The Message Transport provides a generic message routing service for 505 the overlay. The Message Transport layer is responsible for end-to- 506 end message transactions, including retransmissions. Each peer is 507 identified by its location in the overlay as determined by its 508 Node-ID. A component that is a client of the Message Transport can 509 perform two basic functions: 511 o Send a message to a given peer specified by Node-ID or to the peer 512 responsible for a particular Resource-ID. 513 o Receive messages that other peers sent to a Node-ID or Resource-ID 514 for which this peer is responsible. 516 All usages rely on the Message Transport component to send and 517 receive messages from peers. For instance, when a usage wants to 518 store data, it does so by sending Store requests. Note that the 519 Storage component and the Topology Plugin are themselves clients of 520 the Message Transport, because they need to send and receive messages 521 from other peers. 523 The Message Transport API is similar to those described as providing 524 "Key based routing" (KBR), although as RELOAD supports different 525 overlay algorithms (including non-DHT overlay algorithms) that 526 calculate keys in different ways, the actual interface must accept 527 Resource Names rather than actual keys. 529 1.2.3. Storage 531 One of the major functions of RELOAD is to allow nodes to store data 532 in the overlay and to retrieve data stored by other nodes or by 533 themselves. The Storage component is responsible for processing data 534 storage and retrieval messages. For instance, the Storage component 535 might receive a Store request for a given resource from the Message 536 Transport. It would then query the appropriate usage before storing 537 the data value(s) in its local data store and sends a response to the 538 Message Transport for delivery to the requesting peer. Typically, 539 these messages will come for other nodes, but depending on the 540 overlay topology, a node might be responsible for storing data for 541 itself as well, especially if the overlay is small. 543 A peer's Node-ID determines the set of resources that it will be 544 responsible for storing. However, the exact mapping between these is 545 determined by the overlay algorithm used by the overlay. The Storage 546 component will only receive a Store request from the Message 547 Transport if this peer is responsible for that Resource-ID. The 548 Storage component is notified by the Topology Plugin when the 549 Resource-IDs for which it is responsible change, and the Storage 550 component is then responsible for migrating resources to other peers, 551 as required. 553 1.2.4. Topology Plugin 555 RELOAD is explicitly designed to work with a variety of overlay 556 algorithms. In order to facilitate this, the overlay algorithm 557 implementation is provided by a Topology Plugin so that each overlay 558 can select an appropriate overlay algorithm that relies on the common 559 RELOAD core protocols and code. 561 The Topology Plugin is responsible for maintaining the overlay 562 algorithm Routing Table, which is consulted by the Forwarding and 563 Link Management Layer before routing a message. When connections are 564 made or broken, the Forwarding and Link Management Layer notifies the 565 Topology Plugin, which adjusts the routing table as appropriate. The 566 Topology Plugin will also instruct the Forwarding and Link Management 567 Layer to form new connections as dictated by the requirements of the 568 overlay algorithm Topology. The Topology Plugin issues periodic 569 update requests through Message Transport to maintain and update its 570 Routing Table. 572 As peers enter and leave, resources may be stored on different peers, 573 so the Topology Plugin also keeps track of which peers are 574 responsible for which resources. As peers join and leave, the 575 Topology Plugin instructs the Storage component to issue resource 576 migration requests as appropriate, in order to ensure that other 577 peers have whatever resources they are now responsible for. The 578 Topology Plugin is also responsible for providing redundant data 579 storage to protect against loss of information in the event of a peer 580 failure and to protect against compromised or subversive peers. 582 1.2.5. Forwarding and Link Management Layer 584 The Forwarding and Link Management Layer is responsible for getting a 585 packet to the next peer, as determined by the Topology Plugin. This 586 Layer establishes and maintains the network connections as required 587 by the Topology Plugin. This layer is also responsible for setting 588 up connections to other peers through NATs and firewalls using ICE, 589 and it can elect to forward traffic using relays for NAT and firewall 590 traversal. 592 This layer provides a fairly generic interface that allows the 593 topology plugin control the overlay and resource operations and 594 messages. Since each overlay algorithm is defined and functions 595 differently, we generically refer to the table of other peers that 596 the overlay algorithm maintains and uses to route requests 597 (neighbors) as a Routing Table. The Topology Plugin actually owns 598 the Routing Table, and forwarding decisions are made by querying the 599 Topology Plugin for the next hop for a particular Node-ID or 600 Resource-ID. If this node is the destination of the message, the 601 message is delivered to the Message Transport. 603 The Forwarding and Link Management Layer sits on top of the Overlay 604 Link Layer protocols that carry the actual traffic. This 605 specification defines how to use DTLS and TLS protocols to carry 606 RELOAD messages. 608 1.3. Security 610 RELOAD's security model is based on each node having one or more 611 public key certificates. In general, these certificates will be 612 assigned by a central server which also assigns Node-IDs, although 613 self-signed certificates can be used in closed networks. These 614 credentials can be leveraged to provide communications security for 615 RELOAD messages. RELOAD provides communications security at three 616 levels: 618 Connection Level: Connections between peers are secured with TLS 619 or DTLS. 620 Message Level: Each RELOAD message must be signed. 621 Object Level: Stored objects must be signed by the storing peer. 623 These three levels of security work together to allow peers to verify 624 the origin and correctness of data they receive from other peers, 625 even in the face of malicious activity by other peers in the overlay. 626 RELOAD also provides access control built on top of these 627 communications security features. Because the peer responsible for 628 storing a piece of data can validate the signature on the data being 629 stored, the responsible peer can determine whether a given operation 630 is permitted or not. 632 RELOAD also provides a shared secret based admission control feature 633 using shared secrets and TLS-PSK. In order to form a TLS connection 634 to any node in the overlay, a new node needs to know the shared 635 overlay key, thus restricting access to authorized users. 637 1.4. Structure of This Document 639 The remainder of this document is structured as follows. 641 o Section 2 provides definitions of terms used in this document. 642 o Section 3 provides an overview of the mechanisms used to establish 643 and maintain the overlay. 644 o Section 4 provides an overview of the mechanism RELOAD provides to 645 support other applications. 646 o Section 5 defines the protocol messages that RELOAD uses to 647 establish and maintain the overlay. 648 o Section 6 defines the protocol messages that are used to store and 649 retrieve data using RELOAD. 650 o Section 7 defines the Certificate Store Usage that is fundamental 651 to RELOAD security. 652 o Section 8 defines the TURN Server Usage needed to locate TURN 653 servers for NAT traversal. 654 o Section 9 defines a diagnostic usage for obtaining information 655 about node performance. 656 o Section 10 defines a specific Topology Plugin using Chord. 657 o Section 11 defines the mechanisms that new RELOAD nodes use to 658 join the overlay for the first time. 659 o Section 12 provides an extended example. 661 2. Terminology 663 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 664 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 665 document are to be interpreted as described in RFC 2119 [RFC2119]. 667 We use the terminology and definitions from the Concepts and 668 Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft 669 extensively in this document. Other terms used in this document are 670 defined inline when used and are also defined below for reference. 671 Terms which are new to this document (and perhaps should be added to 672 the concepts document) are marked with a (*). 674 DHT: A distributed hash table. A DHT is an abstract hash table 675 service realized by storing the contents of the hash table across 676 a set of peers. 678 Overlay Algorithm: An overlay algorithm defines the rules for 679 determining which peers in an overlay store a particular piece of 680 data and for determining a topology of interconnections amongst 681 peers in order to find a piece of data. 683 Overlay Instance: A specific overlay algorithm and the collection of 684 peers that are collaborating to provide read and write access to 685 it. There can be any number of overlay instances running in an IP 686 network at a time, and each operates in isolation of the others. 688 Peer: A host that is participating in the overlay. Peers are 689 responsible for holding some portion of the data that has been 690 stored in the overlay and also route messages on behalf of other 691 hosts as required by the Overlay Algorithm. 693 Client: A host that is able to store data in and retrieve data from 694 the overlay but which is not participating in routing or data 695 storage for the overlay. 697 Node: We use the term "Node" to refer to a host that may be either a 698 Peer or a Client. Because RELOAD uses the same protocol for both 699 clients and peers, much of the text applies equally to both. 700 Therefore we use "Node" when the text applies to both Clients and 701 Peers and the more specific term when the text applies only to 702 Clients or only to Peers. 704 Node-ID: A 128-bit value that uniquely identifies a node. Node-IDs 705 0 and 2^128 - 1 are reserved and are invalid Node-IDs. A value of 706 zero is not used in the wire protocol but can be used to indicate 707 an invalid node in implementations and APIs. The Node-ID of 708 2^128-1 is used on the wire protocol as a wildcard. (*) 710 Resource: An object or group of objects associated with a string 711 identifier see "Resource Name" below. 713 Resource Name: The potentially human readable name by which a 714 resource is identified. In unstructured P2P networks, the 715 resource name is sometimes used directly as a Resource-ID. In 716 structured P2P networks the resource name is typically mapped into 717 a Resource-ID by using the string as the input to hash function. 718 A SIP resource, for example, is often identified by its AOR which 719 is an example of a Resource Name.(*) 721 Resource-ID: A value that identifies some resources and which is 722 used as a key for storing and retrieving the resource. Often this 723 is not human friendly/readable. One way to generate a Resource-ID 724 is by applying a mapping function to some other unique name (e.g., 725 user name or service name) for the resource. The Resource-ID is 726 used by the distributed database algorithm to determine the peer 727 or peers that are responsible for storing the data for the 728 overlay. In structured P2P networks, Resource-IDs are generally 729 fixed length and are formed by hashing the resource name. In 730 unstructured networks, resource names may be used directly as 731 Resource-IDs and may have variable length. 733 Connection Table: The set of peers to which a node is directly 734 connected. This includes nodes with which Attach handshakes have 735 been done but which have not sent any Updates. 737 Routing Table: The set of peers which a node can use to route 738 overlay messages. In general, these peers will all be on the 739 connection table but not vice versa, because some peers will have 740 Attached but not sent updates. Peers may send messages directly 741 to peers which are on the connection table but may only route 742 messages to other peers through peers which are on the routing 743 table. (*) 745 Destination List: A list of IDs through which a message is to be 746 routed. A single Node-ID is a trivial form of destination list. 747 (*) 749 Usage: A usage is an application that wishes to use the overlay for 750 some purpose. Each application wishing to use the overlay defines 751 a set of data kinds that it wishes to use. The SIP usage defines 752 the location, certificate, STUN server and TURN server data kinds. 753 (*) 755 3. Overlay Management Overview 757 The most basic function of RELOAD is as a generic overlay network. 758 Nodes need to be able to join the overlay, form connections to other 759 nodes, and route messages through the overlay to nodes to which they 760 are not directly connected. This section provides an overview of the 761 mechanisms that perform these functions. 763 3.1. Security and Identification 765 Every node in the RELOAD overlay is identified by a Node-ID. The 766 Node-ID is used for three major purposes: 768 o To address the node itself. 769 o To determine its position in the overlay topology when the overlay 770 is structured. 771 o To determine the set of resources for which the node is 772 responsible. 774 Each node has a certificate [RFC3280] containing a Node-ID, which is 775 globally unique. 777 The certificate serves multiple purposes: 779 o It entitles the user to store data at specific locations in the 780 Overlay Instance. Each data kind defines the specific rules for 781 determining which certificates can access each Resource-ID/Kind-ID 782 pair. For instance, some kinds might allow anyone to write at a 783 given location, whereas others might restrict writes to the owner 784 of a single certificate. 785 o It entitles the user to operate a node that has a Node-ID found in 786 the certificate. When the node forms a connection to another 787 peer, it can use this certificate so that a node connecting to it 788 knows it is connected to the correct node. In addition, the node 789 can sign messages, thus providing integrity and authentication for 790 messages which are sent from the node. 791 o It entitles the user to use the user name found in the 792 certificate. 794 If a user has more than one device, typically they would get one 795 certificate for each device. This allows each device to act as a 796 separate peer. 798 RELOAD supports two certificate issuance models. The first is based 799 on a central enrollment process which allocates a unique name and 800 Node-ID to the node a certificate for a public/private key pair for 801 the user. All peers in a particular Overlay Instance have the 802 enrollment server as a trust anchor and so can verify any other 803 peer's certificate. 805 In some settings, a group of users want to set up an overlay network 806 but are not concerned about attack by other users in the network. 807 For instance, users on a LAN might want to set up a short term ad hoc 808 network without going to the trouble of setting up an enrollment 809 server. RELOAD supports the use of self-generated and self-signed 810 certificates. When self-signed certificates are used, the node also 811 generates its own Node-ID and username. The Node-ID is computed as a 812 digest of the public key, to prevent Node-ID theft, however this 813 model is still subject to a number of known attacks (most notably 814 Sybil attacks [Sybil]) and can only be safely used in closed networks 815 where users are mutually trusting. 817 3.1.1. Shared-Key Security 819 RELOAD also provides an admission control system based on shared 820 keys. In this model, the peers all share a single key which is used 821 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 823 3.2. Clients 825 RELOAD defines a single protocol that is used both as the peer 826 protocol and the client protocol for the overlay. This simplifies 827 implementation, particularly for devices that may act in either role, 828 and allows clients to inject messages directly into the overlay. 830 We use the term "peer" to identify a node in the overlay that routes 831 messages for nodes other than those to which it is directly 832 connected. Peers typically also have storage responsibilities. We 833 use the term "client" to refer to nodes that do not have routing or 834 storage responsibilities. When text applies to both peers and 835 clients, we will simply refer to such a device as a "node." 837 RELOAD's client support allows nodes that are not participating in 838 the overlay as peers to utilize the same implementation and to 839 benefit from the same security mechanisms as the peers. Clients 840 possess and use certificates that authorize the user to store data at 841 its locations in the overlay. The Node-ID in the certificate is used 842 to identify the particular client as a member of the overlay and to 843 authenticate its messages. 845 For more discussion of the motivation for RELOAD's client support, 846 see Appendix C. 848 3.2.1. Client Routing 850 There are two routing options by which a client may be located in an 851 overlay. 853 o Establish a connection to the peer responsible for the client's 854 Node-ID in the overlay. Then requests may be sent from/to the 855 client using its Node-ID in the same manner as if it were a peer, 856 because the responsible peer in the overlay will handle the final 857 step of routing to the client. This will not work in overlays 858 where NAT or firewall do not allow all clients to form connections 859 with any other peer. 860 o Establish a connection with an arbitrary peer in the overlay 861 (perhaps based on network proximity or an inability to establish a 862 direct connection with the responsible peer). In this case, the 863 client will rely on RELOAD's Destination List feature to ensure 864 reachability. The client can initiate requests, and any node in 865 the overlay that knows the Destination List to its current 866 location can reach it, but the client is not directly reachable 867 directly using only its Node-ID. The Destination List required to 868 reach it must be learnable via other mechanisms, such as being 869 stored in the overlay by a usage, if the client is to receive 870 incoming requests from other members of the overlay. 872 3.2.2. Minimum Functionality Requirements for Clients 874 A node may act as a client simply because it does not have the 875 resources or even an implementation of the topology plugin required 876 to acts as a peer in the overlay. In order to exchange RELOAD 877 messages with a peer, a client must meet a minimum level of 878 functionality. Such a client must: 880 o Implement RELOAD's connection-management connections that are used 881 to establish the connection with the peer. 882 o Implement RELOAD's data retrieval methods (with client 883 functionality). 884 o Be able to calculate Resource-IDs used by the overlay. 885 o Possess security credentials required by the overlay it is 886 implementing. 888 A client speaks the same protocol as the peers, knows how to 889 calculate Resource-IDs, and signs its requests in the same manner as 890 peers. While a client does not necessarily require a full 891 implementation of the overlay algorithm, calculating the Resource-ID 892 requires an implementation of the appropriate algorithm for the 893 overlay. 895 RELOAD does not support a separate protocol for clients that do not 896 meet these functionality requirements. Any such extension would 897 either entail compromises on the features of RELOAD or require an 898 entirely new protocol to reimplement the core features of RELOAD. 899 Furthermore, for SIP and many other applications, a native 900 application-level protocol already exists that is sufficient for such 901 a client to interact with a member of the RELOAD overlay. 903 3.3. Routing 905 This section will discuss the requirements RELOAD's routing 906 capabilities must meet, then describe the routing features in the 907 protocol, and provide a brief overview of how they are used. 908 Appendix B discusses some alternative designs and the tradeoffs that 909 would be necessary to support them. 911 RELOAD's routing capabilities must meet the following requirements: 913 NAT Traversal: RELOAD must support establishing and using 914 connections between nodes separated by one or more NATs, including 915 locating peers behind NATs for those overlays allowing/requiring 916 it. 917 Clients: RELOAD must support requests from and to clients that do 918 not participate in overlay routing. 919 Client promotion: RELOAD must support clients that become peers at a 920 later point as determined by the overlay algorithm and deployment. 921 Low state: RELOAD's routing algorithms must not require 922 significant state to be stored on intermediate peers. 923 Return routability in unstable topologies: At some points in 924 times, different nodes may have inconsistent information about the 925 connectivity of the routing graph. In all cases, the response to 926 a request needs to delivered to the node that sent the request and 927 not to some other node. 929 To meet these requirements, RELOAD's routing relies on two basic 930 mechanisms: 932 Via Lists: The forwarding header used by all RELOAD messages 933 contains both a Via List (built hop-by-hop as the message is 934 routed through the overlay) and a Destination List (providing 935 source-routing capabilities for requests and return-path routing 936 for responses). 937 Route_Query: The Route_Query method allows a node to query a peer 938 for the next hop it will use to route a message. This method is 939 useful for diagnostics and for iterative routing. 941 The basic routing mechanism used by RELOAD is Symmetric Recursive. 942 We will first describe symmetric routing and then discuss its 943 advantages in terms of the requirements discussed above. 945 Symmetric recursive routing requires a message follow the path 946 through the overlay to the destination without returning to the 947 originating node: each peer forwards the message closer to its 948 destination. The return path of the response is then the same path 949 followed in reverse. For example, a message following a route from A 950 to Z through B and X: 952 A B X Z 953 ------------------------------- 955 ----------> 956 Dest=Z 957 ----------> 958 Via=A 959 Dest=Z 960 ----------> 961 Via=A, B 962 Dest=Z 964 <---------- 965 Dest=X, B, A 966 <---------- 967 Dest=B, A 968 <---------- 969 Dest=A 971 Note that the preceding Figure does not indicate whether A is a 972 client or peer, A forwards its request to B and the response is 973 returned to A in the same manner regardless of A's role in the 974 overlay. 976 This figure shows use of full via-lists by intermediate peers B and 977 X. However, if B and/or X are willing to store state, then they may 978 elect to truncate the lists, save that information internally (keyed 979 by the transaction id), and return the response message along the 980 path from which it was received when the response is received. This 981 option requires greater state on intermediate peers but saves a small 982 amount of bandwidth and reduces the need for modifying the message in 983 route. Selection of this mode of operation is a choice for the 984 individual peer, the techniques are mutually interoperable even on a 985 single message. The figure below shows B using full via lists but X 986 truncating them and saving the state internally. 988 A B X Z 989 ------------------------------- 991 ----------> 992 Dest=Z 993 ----------> 994 Via=A 995 Dest=Z 996 ----------> 997 Dest=Z 999 <---------- 1000 Dest=X 1001 <---------- 1002 Dest=B, A 1003 <---------- 1004 Dest=A 1006 For debugging purposes, a Route Log attribute is available that 1007 stores information about each peer as the message is forwarded. 1009 RELOAD also supports a basic Iterative routing mode (where the 1010 intermediate peers merely return a response indicating the next hop, 1011 but do not actually forward the message to that next hop themselves). 1012 Iterative routing is implemented using the Route_Query method, which 1013 requests this behavior. Note that iterative routing is selected only 1014 by the initiating node. RELOAD does not support an intermediate peer 1015 returning a response that it will not recursively route a normal 1016 request. The willingness to perform that operation is implicit in 1017 its role as a peer in the overlay. 1019 3.4. Connectivity Management 1021 In order to provide efficient routing, a peer needs to maintain a set 1022 of direct connections to other peers in the Overlay Instance. Due to 1023 the presence of NATs, these connections often cannot be formed 1024 directly. Instead, we use the Attach request to establish a 1025 connection. Attach uses ICE [I-D.ietf-mmusic-ice-tcp] to establish 1026 the connection. It is assumed that the reader is familiar with ICE. 1028 Say that peer A wishes to form a direct connection to peer B. It 1029 gathers ICE candidates and packages them up in an Attach request 1030 which it sends to B through usual overlay routing procedures. B does 1031 its own candidate gathering and sends back a response with its 1032 candidates. A and B then do ICE connectivity checks on the candidate 1033 pairs. The result is a connection between A and B. At this point, A 1034 and B can add each other to their routing tables and send messages 1035 directly between themselves without going through other overlay 1036 peers. 1038 There is one special case in which Attach cannot be used: when a 1039 peer is joining the overlay and is not connected to any peers. In 1040 order to support this case, some small number of "bootstrap nodes" 1041 need to be publicly accessible so that new peers can directly connect 1042 to them. Section 11 contains more detail on this. 1044 In general, a peer needs to maintain connections to all of the peers 1045 near it in the Overlay Instance and to enough other peers to have 1046 efficient routing (the details depend on the specific overlay). If a 1047 peer cannot form a connection to some other peer, this isn't 1048 necessarily a disaster; overlays can route correctly even without 1049 fully connected links. However, a peer should try to maintain the 1050 specified link set and if it detects that it has fewer direct 1051 connections, should form more as required. This also implies that 1052 peers need to periodically verify that the connected peers are still 1053 alive and if not try to reform the connection or form an alternate 1054 one. 1056 3.5. Overlay Algorithm Support 1058 The Topology Plugin allows RELOAD to support a variety of overlay 1059 algorithms. This draft defines a DHT based on Chord [Chord], which 1060 is mandatory to implement, but the base RELOAD protocol is designed 1061 to support a variety of overlay algorithms. 1063 3.5.1. Support for Pluggable Overlay Algorithms 1065 RELOAD defines three methods for overlay maintenance: Join, Update, 1066 and Leave. However, the contents of those messages, when they are 1067 sent, and their precise semantics are specified by the actual overlay 1068 algorithm; RELOAD merely provides a framework of commonly-needed 1069 methods that provides uniformity of notation (and ease of debugging) 1070 for a variety of overlay algorithms. 1072 3.5.2. Joining, Leaving, and Maintenance Overview 1074 When a new peer wishes to join the Overlay Instance, it must have a 1075 Node-ID that it is allowed to use. It uses the Node-ID in the 1076 certificate it received from the enrollment server. The details of 1077 the joining procedure are defined by the overlay algorithm, but the 1078 general steps for joining an Overlay Instance are: 1080 o Forming connections to some other peers. 1081 o Acquiring the data values this peer is responsible for storing. 1083 o Informing the other peers which were previously responsible for 1084 that data that this peer has taken over responsibility. 1086 The first thing the peer needs to do is form a connection to some 1087 "bootstrap node". Because this is the first connection the peer 1088 makes, these nodes must have public IP addresses and therefore can be 1089 connected to directly. Once a peer has connected to one or more 1090 bootstrap nodes, it can form connections in the usual way by routing 1091 Attach messages through the overlay to other nodes. Once a peer has 1092 connected to the overlay for the first time, it can cache the set of 1093 nodes it has connected to with public IP addresses for use as future 1094 bootstrap nodes. 1096 Once the peer has connected to a bootstrap node, it then needs to 1097 take up its appropriate place in the overlay. This requires two 1098 major operations: 1100 o Forming connections to other peers in the overlay to populate its 1101 Routing Table. 1102 o Getting a copy of the data it is now responsible for storing and 1103 assuming responsibility for that data. 1105 The second operation is performed by contacting the Admitting Peer 1106 (AP), the node which is currently responsible for that section of the 1107 overlay. 1109 The details of this operation depend mostly on the overlay algorithm 1110 involved, but a typical case would be: 1112 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1113 announcing its intention to join. 1114 2. AP sends a Join response. 1115 3. AP does a sequence of Stores to JP to give it the data it will 1116 need. 1117 4. AP does Updates to JP and to other peers to tell it about its own 1118 routing table. At this point, both JP and AP consider JP 1119 responsible for some section of the Overlay Instance. 1120 5. JP makes its own connections to the appropriate peers in the 1121 Overlay Instance. 1123 After this process is completed, JP is a full member of the Overlay 1124 Instance and can process Store/Fetch requests. 1126 Note that the first node is a special case. When ordinary nodes 1127 cannot form connections to the bootstrap nodes, then they are not 1128 part of the overlay. However, the first node in the overlay can 1129 obviously not connect to others nodes. In order to support this 1130 case, potential first nodes (which must also serve as bootstrap nodes 1131 initially) must somehow be instructed (perhaps by configuration 1132 settings) that they are the entire overlay, rather than not part of 1133 it. 1135 3.6. First-Time Setup 1137 Previous sections addressed how RELOAD works once a node has 1138 connected. This section provides an overview of how users get 1139 connected to the overlay for the first time. RELOAD is designed so 1140 that users can start with the name of the overlay they wish to join 1141 and perhaps a username and password, and leverage that into having a 1142 working peer with minimal user intervention. This helps avoid the 1143 problems that have been experienced with conventional SIP clients 1144 where users are required to manually configure a large number of 1145 settings. 1147 3.6.1. Initial Configuration 1149 In the first phase of the process, the user starts out with the name 1150 of the overlay and uses this to download an initial set of overlay 1151 configuration parameters. The user does a DNS SRV lookup on the 1152 overlay name to get the address of a configuration server. It can 1153 then connect to this server with HTTPS to download a configuration 1154 document which contains the basic overlay configuration parameters as 1155 well as a set of bootstrap nodes which can be used to join the 1156 overlay. 1158 3.6.2. Enrollment 1160 If the overlay is using centralized enrollment, then a user needs to 1161 acquire a certificate before joining the overlay. The certificate 1162 attests both to the user's name within the overlay and to the Node- 1163 IDs which they are permitted to operate. In that case, the 1164 configuration document will contain the address of an enrollment 1165 server which can be used to obtain such a certificate. The 1166 enrollment server may (and probably will) require some sort of 1167 username and password before issuing the certificate. The enrollment 1168 server's ability to restrict attackers' access to certificates in the 1169 overlay is one of the cornerstones of RELOAD's security. 1171 4. Application Support Overview 1173 RELOAD is not intended to be used alone, but rather as a substrate 1174 for other applications. These applications can use RELOAD for a 1175 variety of purposes: 1177 o To store data in the overlay and retrieve data stored by other 1178 nodes. 1179 o As a discovery mechanism for services such as TURN. 1180 o To form direct connections which can be used to transmit 1181 application-level messages. 1183 This section provides an overview of these services. 1185 4.1. Data Storage 1187 RELOAD provides operations to Store, Fetch, and Remove data. Each 1188 location in the Overlay Instance is referenced by a Resource-ID. 1189 However, each location may contain data elements corresponding to 1190 multiple kinds (e.g., certificate, SIP registration). Similarly, 1191 there may be multiple elements of a given kind, as shown below: 1193 +--------------------------------+ 1194 | Resource-ID | 1195 | | 1196 | +------------+ +------------+ | 1197 | | Kind 1 | | Kind 2 | | 1198 | | | | | | 1199 | | +--------+ | | +--------+ | | 1200 | | | Value | | | | Value | | | 1201 | | +--------+ | | +--------+ | | 1202 | | | | | | 1203 | | +--------+ | | +--------+ | | 1204 | | | Value | | | | Value | | | 1205 | | +--------+ | | +--------+ | | 1206 | | | +------------+ | 1207 | | +--------+ | | 1208 | | | Value | | | 1209 | | +--------+ | | 1210 | +------------+ | 1211 +--------------------------------+ 1213 Each kind is identified by a Kind-ID, which is a code point assigned 1214 by IANA. As part of the kind definition, protocol designers may 1215 define constraints, such as limits on size, on the values which may 1216 be stored. For many kinds, the set may be restricted to a single 1217 value; some sets may be allowed to contain multiple identical items 1218 while others may only have unique items. Note that a kind may be 1219 employed by multiple usages and new usages are encouraged to use 1220 previously defined kinds where possible. We define the following 1221 data models in this document, though other usages can define their 1222 own structures: 1224 single value: There can be at most one item in the set and any value 1225 overwrites the previous item. 1227 array: Many values can be stored and addressed by a numeric index. 1229 dictionary: The values stored are indexed by a key. Often this key 1230 is one of the values from the certificate of the peer sending the 1231 Store request. 1233 In order to protect stored data from tampering, by other nodes, each 1234 stored value is digitally signed by the node which created it. When 1235 a value is retrieved, the digital signature can be verified to detect 1236 tampering. 1238 4.1.1. Storage Permissions 1240 A major issue in peer-to-peer storage networks is minimizing the 1241 burden of becoming a peer, and in particular minimizing the amount of 1242 data which any peer is required to store for other nodes. RELOAD 1243 addresses this issue by only allowing any given node to store data at 1244 a small number of locations in the overlay, with those locations 1245 being determined by the node's certificate. When a peer uses a Store 1246 request to place data at a location authorized by its certificate, it 1247 signs that data with the private key that corresponds to its 1248 certificate. Then the peer responsible for storing the data is able 1249 to verify that the peer issuing the request is authorized to make 1250 that request. Each data kind defines the exact rules for determining 1251 what certificate is appropriate. 1253 The most natural rule is that a certificate authorizes a user to 1254 store data keyed with their user name X. This rules is used for all 1255 the kinds defined in this specification. Thus, only a user with a 1256 certificate for "alice@example.org" could write to that location in 1257 the overlay. However, other usages can define any rules they choose, 1258 including publicly writable values. 1260 The digital signature over the data serves two purposes. First, it 1261 allows the peer responsible for storing the data to verify that this 1262 Store is authorized. Second, it provides integrity for the data. 1263 The signature is saved along with the data value (or values) so that 1264 any reader can verify the integrity of the data. Of course, the 1265 responsible peer can "lose" the value but it cannot undetectable 1266 modify it. 1268 The size requirements of the data being stored in the overlay are 1269 variable. For instance, a SIP AoR and voicemail differ widely in the 1270 storage size. RELOAD leaves it to the Usage and overlay 1271 configuration to address the size imbalance of various kinds. 1273 4.1.2. Usages 1275 By itself, the distributed storage layer just provides infrastructure 1276 on which applications are built. In order to do anything useful, a 1277 usage must be defined. Each Usage specifies several things: 1279 o Registers Kind-ID code points for any kinds that the Usage 1280 defines. 1281 o Defines the data structure for each of the kinds. 1282 o Defines access control rules for each kinds. 1283 o Defines how the Resource Name is formed that is hashed to form the 1284 Resource-ID where each kind is stored. 1285 o Describes how values will be merged after a network partition. 1286 Unless otherwise specified, the default merging rule is to act as 1287 if all the values that need to be merged were stored and that the 1288 order they were stored in corresponds to the stored time values 1289 associated with (and carried in) their values. Because the stored 1290 time values are those associated with the peer which did the 1291 writing, clock skew is generally not an issue. If two nodes are 1292 on different partitions, clocks, this can create merge conflicts. 1293 However because RELOAD deliberately segregates storage so that 1294 data from different users and peers is stored in different 1295 locations, and a single peer will typically only be in a single 1296 network partition, this case will generally not arise. 1298 The kinds defined by a usage may also be applied to other usages. 1299 However, a need for different parameters, such as different size 1300 limits, would imply the need to create a new kind. 1302 4.1.3. Replication 1304 Replication in P2P overlays can be used to provide: 1306 persistence: if the responsible peer crashes and/or if the storing 1307 peer leaves the overlay 1308 security: to guard against DoS attacks by the responsible peer or 1309 routing attacks to that responsible peer 1310 load balancing: to balance the load of queries for popular 1311 resources. 1313 A variety of schemes are used in P2P overlays to achieve some of 1314 these goals. Common techniques include replicating on neighbors of 1315 the responsible peer, randomly locating replicas around the overlay, 1316 or replicating along the path to the responsible peer. 1318 The core RELOAD specification does not specify a particular 1319 replication strategy. Instead, the first level of replication 1320 strategies are determined by the overlay algorithm, which can base 1321 the replication strategy on the its particular topology. For 1322 example, Chord places replicas on successor peers, which will take 1323 over responsibility should the responsible peer fail [Chord]. 1325 If additional replication is needed, for example if data persistence 1326 is particularly important for a particular usage, then that usage may 1327 specify additional replication, such as implementing random 1328 replications by inserting a different well known constant into the 1329 Resource Name used to store each replicated copy of the resource. 1330 Such replication strategies can be added independent of the 1331 underlying algorithm, and their usage can be determined based on the 1332 needs of the particular usage. 1334 4.2. Service Discovery 1336 RELOAD does not currently define a generic service discovery 1337 algorithm as part of the base protocol; although a TURN-specific 1338 discovery mechanism is provided. A variety of service discovery 1339 algorithm can be implemented as extensions to the base protocol, such 1340 as ReDIR [opendht-sigcomm05]. 1342 4.3. Application Connectivity 1344 There is no requirement that a RELOAD usage must use RELOAD's 1345 primitives for establishing its own communication if it already 1346 possesses its own means of establishing connections. For example, 1347 one could design a RELOAD-based resource discovery protocol which 1348 used HTTP to retrieve the actual data. 1350 For more common situations, however, the overlay itself is used to 1351 establish a connection rather than an external authority such as DNS, 1352 RELOAD provides connectivity to applications using the same Attach 1353 method as is used for the overlay maintenance. For example, if a 1354 P2PSIP node wishes to establish a SIP dialog with another P2PSIP 1355 node, it will use Attach to establish a direct connection with the 1356 other node. This new connection is separate from the peer protocol 1357 connection, it is a dedicated UDP or TCP flow used only for the SIP 1358 dialog. Each usage specifies which types of connections can be 1359 initiated using Attach. 1361 5. Overlay Management Protocol 1363 This section defines the basic protocols used to create, maintain, 1364 and use the RELOAD overlay network. We start by defining how 1365 messages are transmitted, received, and routed in an existing 1366 overlay, then define the message structure, and then finally define 1367 the messages used to join and maintain the overlay. 1369 5.1. Message Routing 1371 This section describes procedures used by nodes to route messages 1372 through the overlay. 1374 5.1.1. Request Origination 1376 In order to originate a message to a given Node-ID or Resource-ID, a 1377 node constructs an appropriate destination list. The simplest such 1378 destination list is a single entry containing the peer or 1379 Resource-ID. The resulting message will use the normal overlay 1380 routing mechanisms to forward the message to that destination. The 1381 node can also construct a more complicated destination list for 1382 source routing. 1384 Once the message is constructed, the node sends the message to some 1385 adjacent peer. If the first entry on the destination list is 1386 directly connected, then the message MUST be routed down that 1387 connection. Otherwise, the topology plugin MUST be consulted to 1388 determine the appropriate next hop. 1390 Parallel searches for the resource are a common solution to improve 1391 reliability in the face of churn or of subversive peers. Parallel 1392 searches for usage-specified replicas are managed by the usage layer. 1393 However, a single request can also be routed through multiple 1394 adjacent peers, even when known to be sub-optimal, to improve 1395 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1396 specified by the topology plugin. 1398 Because messages may be lost in transit through the overlay, RELOAD 1399 incorporates an end-to-end reliability mechanism. When an 1400 originating node transmits a request it MUST set a 3 second timer. 1401 If a response has not been received when the timer fires, the request 1402 is retransmitted with the same transaction identifier. The request 1403 MAY be retransmitted up to 4 times (for a total of 5 messages). 1404 After the timer for the fifth transmission fires, the message SHALL 1405 be considered to have failed. Note that this retransmission 1406 procedure is not followed by intermediate nodes. They follow the 1407 hop-by-hop reliability procedure described in Section 5.5.2. 1409 The above algorithm can result in multiple requests being delivered 1410 to a node. Receiving nodes MUST generate semantically equivalent 1411 responses to retransmissions of the same request (this can be 1412 determined by transaction id) if the request is received within the 1413 maximum request lifetime (15 seconds). For some requests (e.g., 1414 FETCH) this can be accomplished merely by processing the request 1415 again. For other requests, (e.g., STORE) it may be necessary to 1416 maintain state for the duration of the request lifetime. 1418 5.1.2. Message Receipt and Forwarding 1420 When a peer receives a message, it first examines the overlay, 1421 version, and other header fields to determine whether the message is 1422 one it can process. If any of these are incorrect (e.g., the message 1423 is for an overlay in which the peer does not participate) it is an 1424 error. The peer SHOULD generate an appropriate error but if local 1425 policy can override this in which case the messages is silently 1426 dropped. 1428 Once the peer has determined that the message is correctly formatted, 1429 it examines the first entry on the destination list. There are three 1430 possible cases here: 1432 o The first entry on the destination list is an id for which the 1433 peer is responsible. 1434 o The first entry on the destination list is a an id for which 1435 another peer is responsible. 1436 o The first entry on the destination list is a private id which is 1437 being used for destination list compression. 1439 These cases are handled as discussed below. 1441 5.1.2.1. Responsible ID 1443 If the first entry on the destination list is a ID for which the node 1444 is responsible, there are several sub-cases. 1445 o If the entry is a Resource-ID, then it MUST be the only entry on 1446 the destination list. If there are other entries, the message 1447 MUST be silently dropped. Otherwise, the message is destined for 1448 this node and it passes it up to the upper layers. 1449 o If the entry is a Node-ID which belongs to this node, then the 1450 message is destined for this node. If this is the only entry on 1451 the destination list, the message is destined for this node and is 1452 passed up to the upper layers. Otherwise the entry is removed 1453 from the destination list and the message is passed it to the 1454 Message Transport. If the message is a response and there is 1455 state for the transaction ID, the state is reinserted into the 1456 destination list first. 1457 o If the entry is a Node-ID which is not equal to this node, then 1458 the node MUST drop the message silently unless the Node-ID 1459 corresponds to a node which is directly connected to this node 1460 (i.e., a client). In that case, it MUST forward the message to 1461 the destination node as described in the next section. 1463 Note that this implies that in order to address a message to "the 1464 peer that controls region X", a sender sends to Resource-ID X, not 1465 Node-ID X. 1467 5.1.2.2. Other ID 1469 If neither of the other two cases applies, then the peer MUST forward 1470 the message towards the first entry on the destination list. This 1471 means that it MUST select one of the peers to which it is connected 1472 and which is likely to be responsible for the first entry on the 1473 destination list. If the first entry on the destination list is in 1474 the peer's connection table, then it SHOULD forward the message to 1475 that peer directly. Otherwise, it consult the routing table to 1476 forward the message. 1478 Any intermediate peer which forwards a RELOAD message MUST arrange 1479 that if it receives a response to that message the response can be 1480 routed back through the set of nodes through which the request 1481 passed. This may be arranged in one of two ways: 1483 o The peer MAY add an entry to the via list in the forwarding header 1484 that will enable it to determine the correct node. 1485 o The peer MAY keep per-transaction state which will allow it to 1486 determine the correct node. 1488 As an example of the first strategy, if node D receives a message 1489 from node C with via list (A, B), then D would forward to the next 1490 node (E) with via list (A, B, C). Now, if E wants to respond to the 1491 message, it reverses the via list to produce the destination list, 1492 resulting in (D, C, B, A). When D forwards the response to C, the 1493 destination list will contain (C, B, A). 1495 As an example of the second strategy, if node D receives a message 1496 from node C with transaction ID X and via list (A, B), it could store 1497 (X, C) in its state database and forward the message with the via 1498 list unchanged. When D receives the response, it consults its state 1499 database for transaction id X, determines that the request came from 1500 C, and forwards the response to C. 1502 Intermediate peer which modify the via list are not required to 1503 simply add entries. The only requirement is that the peer be able to 1504 reconstruct the correct destination list on the return route. RELOAD 1505 provides explicit support for this functionality in the form of 1506 private IDs, which can replace any number of via list entries. For 1507 instance, in the above example, Node D might send E a via list 1508 containing only the private ID (I). E would then use the destination 1509 list (D, I) to send its return message. When D processes this 1510 destination list, it would detect that I is a private ID, recover the 1511 via list (A, B, C), and reverse that to produce the correct 1512 destination list (C, B, A) before sending it to C. This feature is 1513 called List Compression. I MAY either be a compressed version of the 1514 original via list or an index into a state database containing the 1515 original via list. 1517 Note that if an intermediate peer exits the overlay, then on the 1518 return trip the message cannot be forwarded and will be dropped. The 1519 ordinary timeout and retransmission mechanisms provide stability over 1520 this type of failure. 1522 5.1.2.3. Private ID 1524 If the first entry on the destination list is a private id (e.g., a 1525 compressed via list), the peer MUST that entry with the original via 1526 list that it replaced indexes and then re-examine the destination 1527 list to determine which case now applies. 1529 5.1.3. Response Origination 1531 When a peer sends a response to a request, it MUST construct the 1532 destination list by reversing the order of the entries on the via 1533 list. This has the result that the response traverses the same peers 1534 as the request traversed, except in reverse order (symmetric 1535 routing). Note that this rule will need to be relaxed if other 1536 routing algorithms are supported. 1538 5.2. Message Structure 1540 RELOAD is a message-oriented request/response protocol. The messages 1541 are encoded using binary fields. All integers are represented in 1542 network byte order. The general philosophy behind the design was to 1543 use Type, Length, Value fields to allow for extensibility. However, 1544 for the parts of a structure that were required in all messages, we 1545 just define these in a fixed position as adding a type and length for 1546 them is unnecessary and would simply increase bandwidth and 1547 introduces new potential for interoperability issues. 1549 Each message has three parts, concatenated as shown below: 1551 +-------------------------+ 1552 | Forwarding Header | 1553 +-------------------------+ 1554 | Message Contents | 1555 +-------------------------+ 1556 | Signature | 1557 +-------------------------+ 1559 The contents of these parts are as follows: 1561 Forwarding Header: Each message has a generic header which is used 1562 to forward the message between peers and to its final destination. 1563 This header is the only information that an intermediate peer 1564 (i.e., one that is not the target of a message) needs to examine. 1566 Message Contents: The message being delivered between the peers. 1567 From the perspective of the forwarding layer, the contents is 1568 opaque, however, it is interpreted by the higher layers. 1570 Signature: A digital signature over the message contents and parts 1571 of the header of the message. Note that this signature can be 1572 computed without parsing the message contents. 1574 The following sections describe the format of each part of the 1575 message. 1577 5.2.1. Presentation Language 1579 The structures defined in this document are defined using a C-like 1580 syntax based on the presentation language used to define TLS. 1581 Advantages of this style include: 1583 o It is easy to write and familiar enough looking that most readers 1584 can grasp it quickly. 1585 o The ability to define nested structures allows a separation 1586 between high-level and low level message structures. 1587 o It has a straightforward wire encoding that allows quick 1588 implementation, but the structures can be comprehended without 1589 knowing the encoding. 1590 o The ability to mechanically (compile) encoders and decoders. 1592 This presentation is to some extent a placeholder. We consider it an 1593 open question what the final protocol definition method and encodings 1594 use. We expect this to be a question for the WG to decide. 1596 Several idiosyncrasies of this language are worth noting. 1598 o All lengths are denoted in bytes, not objects. 1599 o Variable length values are denoted like arrays with angle 1600 brackets. 1601 o "select" is used to indicate variant structures. 1603 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1604 but only up to 127 values of two bytes (16 bits) each.. 1606 5.2.1.1. Common Definitions 1608 The following definitions are used throughout RELOAD and so are 1609 defined here. They also provide a convenient introduction to how to 1610 read the presentation language. 1612 An enum represents an enumerated type. The values associated with 1613 each possibility are represented in parentheses and the maximum value 1614 is represented as a nameless value, for purposes of describing the 1615 width of the containing integral type. For instance, Boolean 1616 represents a true or false: 1618 enum { false (0), true(1), (255)} Boolean; 1620 A boolean value is either a 1 or a 0 and is represented as a single 1621 byte on the wire. 1623 The NodeId, shown below, represents a single Node-ID. 1625 typedef opaque NodeId[16]; 1627 A NodeId is a fixed-length 128-bit structure represented as a series 1628 of bytes, most significant byte first. Note: the use of "typedef" 1629 here is an extension to the TLS language, but its meaning should be 1630 relatively obvious. 1632 A ResourceId, shown below, represents a single Resource-ID. 1634 typedef opaque ResourceId<0..2^8-1>; 1636 Like a NodeId, a Resource-ID is an opaque string of bytes, but unlike 1637 Node-IDs, Resource-IDs are variable length, up to 255 bytes (2048 1638 bits) in length. On the wire, each ResourceId is preceded by a 1639 single length byte (allowing lengths up to 255). Thus, the 3-byte 1640 value "Foo" would be encoded as: 03 46 4f 4f. 1642 A more complicated example is IpAddressPort, which represents a 1643 network address and can be used to carry either an IPv6 or IPv4 1644 address: 1646 enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 1647 (255)} AddressType; 1649 struct { 1650 uint32 addr; 1651 uint16 port; 1652 } IPv4AddrPort; 1654 struct { 1655 uint128 addr; 1656 uint16 port; 1657 } IPv6AddrPort; 1659 struct { 1660 AddressType type; 1661 uint8 length; 1663 select (type) { 1664 case ipv4_address: 1665 IPv4AddrPort v4addr_port; 1667 case ipv6_address: 1668 IPv6AddrPort v6addr_port; 1670 /* This structure can be extended */ 1672 } IpAddressPort; 1674 The first two fields in the structure are the same no matter what 1675 kind of address is being represented: 1677 type 1678 the type of address (v4 or v6). 1680 length 1681 the length of the rest of the structure. 1683 By having the type and the length appear at the beginning of the 1684 structure regardless of the kind of address being represented, an 1685 implementation which does not understand new address type X can still 1686 parse the IpAddressPort field and then discard it if it is not 1687 needed. 1689 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1690 an IPv6AddrPort. Both of these simply consist of an address 1691 represented as an integer and a 16-bit port. As an example, here is 1692 the wire representation of the IPv4 address "192.0.2.1" with port 1693 "6100". 1695 01 ; type = IPv4 1696 06 ; length = 6 1697 c0 00 02 01 ; address = 192.0.2.1 1698 17 d4 ; port = 6100 1700 5.2.2. Forwarding Header 1702 The forwarding header is defined as a ForwardingHeader structure, as 1703 shown below. 1705 struct { 1706 uint32 relo_token; 1707 uint32 overlay; 1708 uint8 ttl; 1709 uint8 reserved; 1710 uint16 fragment; 1711 uint8 version; 1712 uint24 length; 1713 uint64 transaction_id; 1714 uint16 flags; 1716 uint16 via_list_length; 1717 uint16 destination_list_length; 1718 uint16 route_log_length; 1719 uint16 options_length; 1720 Destination via_list[via_list_length]; 1721 Destination destination_list 1722 [destination_list_length]; 1723 RouteLogEntry route_log[route_log_length]; 1724 ForwardingOptions options[options_length]; 1725 } ForwardingHeader; 1727 The contents of the structure are: 1729 relo_token 1730 The first four bytes identify this message as a RELOAD message. 1731 The message is easy to demultiplex from STUN messages by looking 1732 at the first bit. This field MUST contain the value 0xc2454c4f 1733 (the string 'RELO' with the high bit of the first byte set.). 1735 overlay 1736 The 32 bit checksum/hash of the overlay being used. The variable 1737 length string representing the overlay name is hashed with SHA-1 1738 and the low order 32 bits are used. The purpose of this field is 1739 to allow nodes to participate in multiple overlays and to detect 1740 accidental misconfiguration. This is not a security critical 1741 function. 1743 ttl 1744 An 8 bit field indicating the number of iterations, or hops, a 1745 message can experience before it is discarded. The TTL value MUST 1746 be decremented by one at every hop along the route the message 1747 traverses. If the TTL is 0, the message MUST NOT be propagated 1748 further and MUST be discarded. The initial value of the TTL 1749 should be TBD. 1751 fragment 1752 This field is used to handle fragmentation. The high order two 1753 bits are used to indicate the fragmentation status: If the high 1754 bit (0x8000) is set, it indicates that the message is a fragment. 1755 If the next bit (0x4000) is set, it indicates that this is the 1756 last fragment. 1757 The remainder of the field is used to indicate the fragment 1758 offset. [[Open Issue: This is conceptually clear, but the 1759 details are still lacking. Need to define the fragment offset and 1760 total length be encoded in the header. Right now we have 14 bits 1761 reserved with the intention that they be used for fragmenting, 1762 though additional bytes in the header might be needed for 1763 fragmentation.]] 1765 version 1766 The version of the RELOAD protocol being used. This document 1767 describes version 0.1, with a value of 0x01. 1769 length 1770 The count in bytes of the size of the message, including the 1771 header. 1773 transaction_id 1774 A unique 64 bit number that identifies this transaction and also 1775 serves as a salt to randomize the request and the response. 1776 Responses use the same Transaction ID as the request they 1777 correspond to. Transaction IDs are also used for fragment 1778 reassembly. 1780 flags 1781 The flags word contains control flags. Which are ORed together. 1782 There is two currently defined flags: ROUTE-LOG (0x1) and 1783 RESPONSE-ROUTE-LOG (0x2). These flags indicate that the route log 1784 should be included (see Section 5.2.2.2.). 1786 via_list_length 1787 The length of the via list in bytes. Note that in this field and 1788 the following two length fields we depart from the usual variable- 1789 length convention of having the length immediately precede the 1790 value in order to make it easier for hardware decoding engines to 1791 quickly determine the length of the header. 1793 destination_list_length 1794 The length of the destination list in bytes. 1796 route_log_length 1797 The length of the route log in bytes. 1799 options_length 1800 The length of the header options in bytes. 1802 via_list 1803 The via_list contains the sequence of destinations through which 1804 the message has passed. The via_list starts out empty and grows 1805 as the message traverses each peer. 1807 destination_list 1808 The destination_list contains a sequence of destinations which the 1809 message should pass through. The destination list is constructed 1810 by the message originator. The first element in the destination 1811 list is where the message goes next. The list shrinks as the 1812 message traverses each listed peer. 1814 route_log 1815 Contains a series of route log entries. See Section 5.2.2.2. 1817 options 1818 Contains a series of ForwardingOptions entries. See 1819 Section 5.2.2.3. 1821 5.2.2.1. Destination and Via Lists 1823 The destination list and via lists are sequences of Destination 1824 values: 1826 enum {reserved(0), peer(1), resource(2), compressed(3), (255) } 1827 DestinationType; 1829 select (destination_type) { 1830 case peer: 1831 NodeId node_id; 1833 case resource: 1834 ResourceId resource_id; 1836 case compressed: 1837 opaque compressed_id<0..2^8-1>; 1839 /* This structure may be extended with new types */ 1841 } DestinationData; 1843 struct { 1844 DestinationType type; 1845 uint8 length; 1846 DestinationData destination_data; 1847 } Destination; 1849 This is a TLV structure with the following contents: 1851 type 1852 The type of the DestinationData PDU. This may be one of "peer", 1853 "resource", or "compressed". 1855 length 1856 The length of the destination_data. 1858 destination_value 1859 The destination value itself, which is an encoded DestinationData 1860 structure, depending on the value of "type". 1862 Note: This structure encodes a type, length, value. The length 1863 field specifies the length of the DestinationData values, which 1864 allows the addition of new DestinationTypes. This allows an 1865 implementation which does not understand a given DestinationType 1866 to skip over it. 1868 A DestinationData can be one of three types: 1870 peer 1871 A Node-ID. 1873 compressed 1874 A compressed list of Node-IDs and/or resources. Because this 1875 value was compressed by one of the peers, it is only meaningful to 1876 that peer and cannot be decoded by other peers. Thus, it is 1877 represented as an opaque string. 1879 resource 1880 The Resource-ID of the resource which is desired. This type MUST 1881 only appear in the final location of a destination list and MUST 1882 NOT appear in a via list. It is meaningless to try to route 1883 through a resource. 1885 5.2.2.2. Route Logging 1887 The route logging feature provides diagnostic information about the 1888 path taken by the message so far and in this manner it is similar in 1889 function to SIP's [RFC3261] Via header field. If the ROUTE-LOG flag 1890 is set in the Flags word, at each hop peers MUST append a route log 1891 entry to the route log element in the header or reject the request. 1892 The order of the route log entry elements in the message is 1893 determined by the order of the peers were traversed along the path. 1894 The first route log entry corresponds to the peer at the first hop 1895 along the path, and each subsequent entry corresponds to the peer at 1896 the next hop along the path. If the ROUTE-LOG flag is set, the route 1897 log entries in the request MUST be copied to the response or the 1898 request rejected. If, and only if, the ROUTE-LOG-RESPONSE flag is 1899 set in a request, the ROUTE-LOG flag MUST be set in the response. 1901 Note that use of the ROUTE-LOG-RESPONSE flag means that the response 1902 will grow on the return path, which may potentially mean that it gets 1903 dropped due to becoming too large for some intermediate hop. Thus, 1904 this option must be used with care. 1906 The route log is defined as follows: 1908 enum { (255) } RouteLogExtensionType; 1910 struct { 1911 RouteLogExtensionType type; 1912 uint16 length; 1914 select (type){ 1915 /* Extension values go here */ 1916 } extension; 1917 } RouteLogExtension; 1919 enum { 1920 reserved(0), 1921 tcp_tls(1), 1922 udp_dtls(2), 1923 (255) 1924 } OverlayLink; 1926 struct { 1927 opaque version<0..2^8-1>; /* A string */ 1928 OverlayLink linkProtocol; /* TCP or UDP */ 1929 NodeId id; 1930 uint32 uptime; 1931 IpAddressPort address; 1932 opaque certificate<0..2^16-1>; 1933 RouteLogExtension extensions<0..2^16-1>; 1934 } RouteLogEntry; 1936 struct { 1937 RouteLogEntry entries<0..2^16-1>; 1938 } RouteLog; 1940 The route log consists of an arbitrary number of RouteLogEntry 1941 values, each representing one node through which the message has 1942 passed. 1944 Each RouteLogEntry consists of the following values: 1946 version 1947 A textual representation of the software version 1949 linkProtocol 1950 The Overlay Link Layer protocol, currently either "tcp_tls" or 1951 "udp_dtls". 1953 id 1954 The Node-ID of the peer. 1956 uptime 1957 The uptime of the peer in seconds. 1959 address 1960 The address and port of the peer. 1962 certificate 1963 The peer's certificate. Note that this may be omitted by setting 1964 the length to zero. 1966 extensions 1967 Extensions, if any. 1969 Extensions are defined using a RouteLogExtension structure. New 1970 extensions are defined by defining a new code point for 1971 RouteLogExtensionType and adding a new arm to the RouteLogExtension 1972 structure. The contents of that structure are: 1974 type 1975 The type of the extension. 1977 length 1978 The length of the rest of the structure. 1980 extension 1981 The extension value. 1983 5.2.2.3. Forwarding Options 1985 The Forwarding header can be extended with forwarding header options, 1986 which are a series of ForwardingOptions structures: 1988 enum { (255) } ForwardingOptionsType; 1990 struct { 1991 ForwardingOptionsType type; 1992 uint8 flags; 1993 uint16 length; 1994 select (type) { 1995 /* Option values go here */ 1996 } option; 1998 } ForwardingOption; 2000 Each ForwardingOption consists of the following values: 2002 type 2003 The type of the option. 2005 length 2006 The length of the rest of the structure. 2008 flags 2009 Three flags are defined FORWARD_CRITICAL(0x01), 2010 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2011 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2012 set, any node that would forward the message but does not 2013 understand this options MUST reject the request with an 757 error 2014 response. If the DESTINATION_CRITICAL flag is set, any node 2015 generates a response to the message but does not understand the 2016 forwarding option MUST reject the request with an 757 error 2017 response. If the RESPONSE_COPY flag is set, any node generating a 2018 response MUST copy the option from the request to the response and 2019 clear the RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL 2020 flags. 2022 option 2023 The option value. 2025 5.2.3. Message Contents Format 2027 The second major part of a RELOAD message is the contents part, which 2028 is defined by MessageContents: 2030 struct { 2031 MessageCode message_code; 2032 opaque payload<0..2^24-1>; 2033 } MessageContents; 2035 The contents of this structure are as follows: 2037 message_code 2038 This indicates the message that is being sent. The code space is 2039 broken up as follows. 2041 0 Reserved 2043 1 .. 0x7fff Requests and responses. These code points are always 2044 paired, with requests being odd and the corresponding response 2045 being the request code plus 1. Thus, "probe_request" (the 2046 Probe request) has value 1 and "probe_answer" (the Probe 2047 response) has value 2 2049 0xffff Error 2051 message_body 2052 The message body itself, represented as a variable-length string 2053 of bytes. The bytes themselves are dependent on the code value. 2054 See the sections describing the various RELOAD methods (Join, 2055 Update, Attach, Store, Fetch, etc.) for the definitions of the 2056 payload contents. 2058 5.2.3.1. Response Codes and Response Errors 2060 A peer processing a request returns its status in the message_code 2061 field. If the request was a success, then the message code is the 2062 response code that matches the request (i.e., the next code up). The 2063 response payload is then as defined in the request/response 2064 descriptions. 2066 If the request failed, then the message code is set to 0xffff (error) 2067 and the payload MUST be an error_response PDU, as shown below. 2069 When the message code is 0xffff, the payload MUST be an 2070 ErrorResponse. 2072 public struct { 2073 uint16 error_code; 2074 opaque error_info<0..2^16-1>; 2075 } ErrorResponse; 2077 The contents of this structure are as follows: 2079 error_code 2080 A numeric error code indicating the error that occurred. 2082 error_info 2083 A free form text string indicating the reason for the response for 2084 diagnostic purposes. 2086 The following error code values are defined. The numeric values for 2087 these are defined in Section 14.5. 2089 Error_Unauthorized: The requesting peer needs to sign and provide a 2090 certificate. [[TODO: The semantics here don't seem quite 2091 right.]] 2093 Error_Forbidden: The requesting peer does not have permission to 2094 make this request. 2096 Error_Not_Found: The resource or peer cannot be found or does not 2097 exist. 2099 Error_Request_Timeout: A response to the request has not been 2100 received in a suitable amount of time. The requesting peer MAY 2101 resend the request at a later time. 2103 Error_Precondition_Failed: A request can't be completed because some 2104 precondition was incorrect. For instance, the wrong generation 2105 counter was provided 2107 Error_Incompatible_with_Overlay: A peer receiving the request is 2108 using a different overlay, overlay algorithm, or hash algorithm. 2110 Error_Unsupported_Forwarding_Option: A peer receiving the request 2111 with a forwarding options flagged as critical but the peer does 2112 not support this option. See section Section 5.2.2.3. 2114 5.2.4. Signature 2116 The third part of a RELOAD message is the signature, represented by a 2117 Signature structure. The message signature is computed over the 2118 payload and parts of forwarding header. The payload, in case of a 2119 Store, may contain an additional signature computed over a StoreReq 2120 structure. All signatures are formatted using the Signature element. 2121 This element is also used in other contexts where signatures are 2122 needed. The input structure to the signature computation varies 2123 depending on the data element being signed. 2125 enum {reserved(0), signer_identity_peer (1), 2126 signer_identity_name (2), signer_identity_certificate (3), 2127 (255)} SignerIdentityType; 2129 select (identity_type) { 2130 case signer_identity_peer: 2131 NodeId id; 2133 case signer_identity_name: 2134 opaque name<0..2^16-1>; 2136 case signer_identity_certificate: 2137 opaque certificate<0..2^16-1>; 2139 /* This structure may be extended with new types */ 2140 } SignerIdentityValue; 2142 struct { 2143 SignerIdentityType identity_type; 2144 uint16 length; 2145 SignerIdentityValue identity[SignerIdentity.length]; 2146 } SignerIdentity; 2148 struct { 2149 SignatureAndHashAlgorithm algorithm; 2150 SignerIdentity identity; 2151 opaque signature_value<0..2^16-1>; 2152 } Signature; 2154 The signature construct contains the following values: 2156 algorithm 2157 The signature algorithm in use. The algorithm definitions are 2158 found in the IANA TLS SignatureAlgorithm Registry. 2160 identity 2161 The identity or certificate used to form the signature 2163 signature_value 2164 The value of the signature 2166 A number of possible identity formats are permitted. The current 2167 possibilities are: a Node-ID, a user name, and a certificate. 2169 For signatures over messages the input to the signature is computed 2170 over: 2172 overlay + transaction_id + MessageContents + SignerIdentity 2174 Where overlay and transaction_id come from the forwarding header and 2175 + indicates concatenation. 2177 [[TODO: Check the inputs to this carefully.]] 2179 The input to signatures over data values is different, and is 2180 described in Section 6.1. 2182 5.3. Overlay Topology 2184 As discussed in previous sections, RELOAD does not itself implement 2185 any overlay topology. Rather, it relies on Topology Plugins, which 2186 allow a variety of overlay algorithms to be used while maintaining 2187 the same RELOAD core. This section describes the requirements for 2188 new topology plugins and the methods that RELOAD provides for overlay 2189 topology maintenance. 2191 5.3.1. Topology Plugin Requirements 2193 When specifying a new overlay algorithm, at least the following need 2194 to be described: 2196 o Joining procedures, including the contents of the Join message. 2197 o Stabilization procedures, including the contents of the Update 2198 message, the frequency of topology probes and keepalives, and the 2199 mechanism used to detect when peers have disconnected. 2200 o Exit procedures, including the contents of the Leave message. 2201 o The length of the Resource-IDs and Node-IDs. For DHTs, the hash 2202 algorithm to compute the hash of an identifier. 2203 o The procedures that peers use to route messages. 2204 o The replication strategy used to ensure data redundancy. 2206 5.3.2. Methods and types for use by topology plugins 2208 This section describes the methods that topology plugins use to join, 2209 leave, and maintain the overlay. 2211 5.3.2.1. Join 2213 A new peer (but which already has credentials) uses the JoinReq 2214 message to join the overlay. The JoinReq is sent to the responsible 2215 peer depending on the routing mechanism described in the topology 2216 plugin. This notifies the responsible peer that the new peer is 2217 taking over some of the overlay and it needs to synchronize its 2218 state. 2220 struct { 2221 NodeId joining_peer_id; 2222 opaque overlay_specific_data<0..2^16-1>; 2223 } JoinReq; 2225 The minimal JoinReq contains only the Node-ID which the sending peer 2226 wishes to assume. Overlay algorithms MAY specify other data to 2227 appear in this request. 2229 If the request succeeds, the responding peer responds with a JoinAns 2230 message, as defined below: 2232 struct { 2233 opaque overlay_specific_data<0..2^16-1>; 2234 } JoinAns; 2236 If the request succeeds, the responding peer MUST follow up by 2237 executing the right sequence of Stores and Updates to transfer the 2238 appropriate section of the overlay space to the joining peer. In 2239 addition, overlay algorithms MAY define data to appear in the 2240 response payload that provides additional info. 2242 In general, nodes which cannot form connections SHOULD report an 2243 error. However, implementations MUST provide some mechanism whereby 2244 nodes can determine they are potentially the first node and take 2245 responsibility for the overlay. This specification does not mandate 2246 any particular mechanism, but a configuration flag or setting seems 2247 appropriate. 2249 5.3.2.2. Leave 2251 The LeaveReq message is used to indicate that a node is exiting the 2252 overlay. A node SHOULD send this message to each peer with which it 2253 is directly connected prior to exiting the overlay. 2255 public struct { 2256 NodeId leaving_peer_id; 2257 opaque overlay_specific_data<0..2^16-1>; 2258 } LeaveReq; 2260 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2261 algorithms MAY specify other data to appear in this request. 2263 Upon receiving a Leave request, a peer MUST update its own routing 2264 table, and send the appropriate Store/Update sequences to re- 2265 stabilize the overlay. 2267 5.3.2.3. Update 2269 Update is the primary overlay-specific maintenance message. It is 2270 used by the sender to notify the recipient of the sender's view of 2271 the current state of the overlay (its routing state) and it is up to 2272 the recipient to take whatever actions are appropriate to deal with 2273 the state change. 2275 The contents of the UpdateReq message are completely overlay- 2276 specific. The UpdateAns response is expected to be either success or 2277 an error. 2279 5.3.2.4. Route_Query 2281 The Route_Query request allows the sender to ask a peer where they 2282 would route a message directed to a given destination. In other 2283 words, a RouteQuery for a destination X requests the Node-ID where 2284 the receiving peer would next route to get to X. A RouteQuery can 2285 also request that the receiving peer initiate an Update request to 2286 transfer his routing table. 2288 One important use of the RouteQuery request is to support iterative 2289 routing. The sender selects one of the peers in its routing table 2290 and sends it a RouteQuery message with the destination_object set to 2291 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2292 responds with information about the peers to which the request would 2293 be routed. The sending peer MAY then Attaches to that peer(s), and 2294 repeats the RouteQuery. Eventually, the sender gets a response from 2295 a peer that is closest to the identifier in the destination_object as 2296 determined by the topology plugin. At that point, the sender can 2297 send messages directly to that peer. 2299 5.3.2.4.1. Request Definition 2301 A RouteQueryReq message indicates the peer or resource that the 2302 requesting peer is interested in. It also contains a "send_update" 2303 option allowing the requesting peer to request a full copy of the 2304 other peer's routing table. 2306 struct { 2307 Boolean send_update; 2308 Destination destination; 2309 opaque overlay_specific_data<0..2^16-1>; 2310 } RouteQueryReq; 2312 The contents of the RouteQueryReq message are as follows: 2314 send_update 2315 A single byte. This may be set to "true" to indicate that the 2316 requester wishes the responder to initiate an Update request 2317 immediately. Otherwise, this value MUST be set to "false". 2319 destination 2320 The destination which the requester is interested in. This may be 2321 any valid destination object, including a Node-ID, compressed ids, 2322 or Resource-ID. 2324 overlay_specific_data 2325 Other data as appropriate for the overlay. 2327 5.3.2.4.2. Response Definition 2329 A response to a successful RouteQueryReq request is a RouteQueryAns 2330 message. This is completely overlay specific. 2332 5.3.2.5. Probe 2334 Probe provides a number of primitive "exploration" services: (1) it 2335 allows node to determine which resources another node is responsible 2336 for (2) it allows some discovery services in multicast settings. A 2337 probe can be addressed to a specific Node-ID, or the peer controlling 2338 a given location (by using a resource ID). In either case, the 2339 target Node-IDs respond with a simple response containing some status 2340 information. 2342 5.3.2.5.1. Request Definition 2344 The ProbeReq message contains a list (potentially empty) of the 2345 pieces of status information that the requester would like the 2346 responder to provide. 2348 enum { responsible_set(1), num_resources(2), (255)} 2349 ProbeInformationType; 2351 struct { 2352 ProbeInformationType requested_info<0..2^8-1>; 2353 } ProbeReq 2355 The two currently defined values for ProbeInformation are: 2357 responsible_set 2358 indicates that the peer should Respond with the fraction of the 2359 overlay for which the responding peer is responsible. 2361 num_resources 2362 indicates that the peer should Respond with the number of 2363 resources currently being stored by the peer. 2365 5.3.2.5.2. Response Definition 2367 A successful ProbeAns response contains the information elements 2368 requested by the peer. 2370 struct { 2371 ProbeInformationType type; 2373 select (type) { 2374 case responsible_set: 2375 uint32 responsible_ppb; 2377 case num_resources: 2378 uint32 num_resources; 2380 /* This type may be extended */ 2382 }; 2383 } ProbeInformation; 2385 struct { 2386 ProbeInformation probe_info<0..2^16-1>; 2387 } ProbeAns; 2389 A ProbeAns message contains the following elements: 2391 probe_info 2392 A sequence of ProbeInformation structures, as shown below. 2394 Each of the current possible Probe information types is a 32-bit 2395 unsigned integer. For type "responsible_ppb", it is the fraction of 2396 the overlay for which the peer is responsible in parts per billion. 2397 For type "num_resources", it is the number of resources the peer is 2398 storing. 2400 The responding peer SHOULD include any values that the requesting 2401 peer requested and that it recognizes. They SHOULD be returned in 2402 the requested order. Any other values MUST NOT be returned. 2404 5.4. Forwarding and Link Management Layer 2406 Each node maintains connections to a set of other nodes defined by 2407 the topology plugin. This section defines the methods RELOAD uses to 2408 form and maintain connections between nodes in the overlay. Three 2409 methods are defined: 2411 Attach: used to form connections between nodes. When node A wants 2412 to connect to node B, it sends an Attach message to node B through 2413 the overlay. The Attach contains A's ICE parameters. B responds 2414 with its ICE parameters and the two nodes perform ICE to form 2415 connection. 2416 AttachLite: like attach, it is used to form connections between 2417 nodes but instead of using full ICE, it only uses a subset known 2418 as ICE-Lite. 2419 Ping: is a simple request/response which is used to verify 2420 connectivity of the target peer. 2422 5.4.1. Attach 2424 A node sends an Attach request when it wishes to establish a direct 2425 TCP or UDP connection to another node for the purposes of sending 2426 RELOAD messages or application layer protocol messages, such as SIP. 2427 Detailed procedures for the Attach and its response are described in 2428 Section 5.4.1. 2430 An Attach in and of itself does not result in updating the routing 2431 table of either node. That function is performed by Updates. If 2432 node A has Attached to node B, but not received any Updates from B, 2433 it MAY route messages which are directly addressed to B through that 2434 channel but MUST NOT route messages through B to other peers via that 2435 channel. The process of Attaching is separate from the process of 2436 becoming a peer (using Update) to prevent half-open states where a 2437 node has started to form connections but is not really ready to act 2438 as a peer. 2440 5.4.1.1. Request Definition 2442 An AttachReq message contains the requesting peer's ICE connection 2443 parameters formatted into a binary structure. 2445 typedef opaque IceCandidate<0..2^16-1>; 2447 struct { 2448 opaque ufrag<0..2^8-1>; 2449 opaque password<0..2^8-1>; 2450 uint16 application; 2451 opaque role<0..2^8-1>; 2452 IceCandidate candidates<0..2^16-1>; 2453 } AttachReqAns; 2455 The values contained in AttachReq and AttachAns are: 2457 ufrag 2458 The username fragment (from ICE) 2460 password 2461 The ICE password. 2463 application 2464 A 16-bit port number. This port number represents the IANA 2465 registered port of the protocol that is going to be sent on this 2466 connection. For SIP, this is 5060 or 5061, and for RELOAD is TBD. 2467 By using the IANA registered port, we avoid the need for an 2468 additional registry and allow RELOAD to be used to set up 2469 connections for any existing or future application protocol. 2471 role 2472 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 2474 candidates 2475 One or more ICE candidate values in the string representation used 2476 in ordinary ICE. [[OPEN ISSUE: This is convenient for stacks, 2477 but unaesthetic.]] Each candidate has an IP address, IP address 2478 family, port, transport protocol, priority, foundation, component 2479 ID, STUN type and related address. The candidate_list is a list 2480 of string candidate values from ICE. 2482 These values should be generated using the procedures described in 2483 Section 5.4.1.3. 2485 5.4.1.2. Response Definition 2487 If a peer receives an Attach request, it SHOULD follow the process 2488 the request and generate its own response with a AttachReqAns. It 2489 should then begin ICE checks. When a peer receives an Attach 2490 response, it SHOULD parse the response and begin its own ICE checks. 2492 5.4.1.3. Using ICE With RELOAD 2494 This section describes the profile of ICE that is used with RELOAD. 2495 RELOAD implementations MUST implement full ICE. Because RELOAD 2496 always tries to use TCP and then UDP as a fallback, there will be 2497 multiple candidates of the same IP version, which requires full ICE. 2499 In ICE as defined by [I-D.ietf-mmusic-ice], SDP is used to carry the 2500 ICE parameters. In RELOAD, this function is performed by a binary 2501 encoding in the Attach method. This encoding is more restricted than 2502 the SDP encoding because the RELOAD environment is simpler: 2504 o Only a single media stream is supported. 2505 o In this case, the "stream" refers not to RTP or other types of 2506 media, but rather to a connection for RELOAD itself or for SIP 2507 signaling. 2508 o RELOAD only allows for a single offer/answer exchange. Unlike the 2509 usage of ICE within SIP, there is never a need to send a 2510 subsequent offer to update the default candidates to match the 2511 ones selected by ICE. 2513 An agent follows the ICE specification as described in 2514 [I-D.ietf-mmusic-ice] and [I-D.ietf-mmusic-ice-tcp] with the changes 2515 and additional procedures described in the subsections below. 2517 5.4.1.4. Collecting STUN Servers 2519 ICE relies on the node having one or more STUN servers to use. In 2520 conventional ICE, it is assumed that nodes are configured with one or 2521 more STUN servers through some out-of-band mechanism. This is still 2522 possible in RELOAD but RELOAD also learns STUN servers as it connects 2523 to other peers. Because all RELOAD peers implement ICE and use STUN 2524 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2525 peer a node knows will be willing to be a STUN server -- though of 2526 course it may be behind a NAT. 2528 A peer on a well-provisioned wide-area overlay will be configured 2529 with one or more bootstrap peers. These peers make an initial list 2530 of STUN servers. However, as the peer forms connections with 2531 additional peers, it builds more peers it can use as STUN servers. 2533 Because complicated NAT topologies are possible, a peer may need more 2534 than one STUN server. Specifically, a peer that is behind a single 2535 NAT will typically observe only two IP addresses in its STUN checks: 2536 its local address and its server reflexive address from a STUN server 2537 outside its NAT. However, if there are more NATs involved, it may 2538 discover that it learns additional server reflexive addresses (which 2539 vary based on where in the topology the STUN server is). To maximize 2540 the chance of achieving a direct connection, a peer SHOULD group 2541 other peers by the peer-reflexive addresses it discovers through 2542 them. It SHOULD then select one peer from each group to use as a 2543 STUN server for future connections. 2545 Only peers to which the peer currently has connections may be used. 2546 If the connection to that host is lost, it MUST be removed from the 2547 list of stun servers and a new server from the same group SHOULD be 2548 selected. 2550 5.4.1.5. Gathering Candidates 2552 When a node wishes to establish a connection for the purposes of 2553 RELOAD signaling or SIP signaling (or any other application protocol 2554 for that matter), it follows the process of gathering candidates as 2555 described in Section 4 of ICE [I-D.ietf-mmusic-ice]. RELOAD utilizes 2556 a single component, as does SIP. Consequently, gathering for these 2557 "streams" requires a single component. 2559 An agent MUST implement ICE-tcp [I-D.ietf-mmusic-ice], and MUST 2560 gather at least one UDP and one TCP host candidate for RELOAD and for 2561 SIP. 2563 The ICE specification assumes that an ICE agent is configured with, 2564 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2565 for an agent to learn these by querying the overlay, as described in 2566 Section 5.4.1.4 and Section 8. 2568 The agent SHOULD prioritize its TCP-based candidates over its UDP- 2569 based candidates in the prioritization described in Section 4.1.2 of 2570 ICE [I-D.ietf-mmusic-ice]. 2572 The default candidate selection described in Section 4.1.3 of ICE is 2573 ignored; defaults are not signaled or utilized by RELOAD. 2575 5.4.1.6. Encoding the Attach Message 2577 Section 4.3 of ICE describes procedures for encoding the SDP for 2578 conveying RELOAD or SIP ICE candidates. Instead of actually encoding 2579 an SDP, the candidate information (IP address and port and transport 2580 protocol, priority, foundation, component ID, type and related 2581 address) is carried within the attributes of the Attach request or 2582 its response. Similarly, the username fragment and password are 2583 carried in the Attach message or its response. Section 5.4.1 2584 describes the detailed attribute encoding for Attach. The Attach 2585 request and its response do not contain any default candidates or the 2586 ice-lite attribute, as these features of ICE are not used by RELOAD. 2587 The Attach request and its response also contain a application 2588 attribute, with a value of SIP or RELOAD, which indicates what 2589 protocol is to be run over the connection. The RELOAD Attach request 2590 MUST only be utilized to set up connections for application protocols 2591 that can be multiplexed with STUN. 2593 Since the Attach request contains the candidate information and short 2594 term credentials, it is considered as an offer for a single media 2595 stream that happens to be encoded in a format different than SDP, but 2596 is otherwise considered a valid offer for the purposes of following 2597 the ICE specification. Similarly, the Attach response is considered 2598 a valid answer for the purposes of following the ICE specification. 2600 5.4.1.7. Verifying ICE Support 2602 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2603 of ICE. Since RELOAD requires full ICE from all agents, this check 2604 is not required. 2606 5.4.1.8. Role Determination 2608 The roles of controlling and controlled as described in Section 5.2 2609 of ICE are still utilized with RELOAD. However, the offerer (the 2610 entity sending the Attach request) will always be controlling, and 2611 the answerer (the entity sending the Attach response) will always be 2612 controlled. The connectivity checks MUST still contain the ICE- 2613 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2614 role reversal capability for which they are defined will never be 2615 needed with RELOAD. This is to allow for a common codebase between 2616 ICE for RELOAD and ICE for SDP. 2618 5.4.1.9. Connectivity Checks 2620 The processes of forming check lists in Section 5.7 of ICE, 2621 scheduling checks in Section 5.8, and checking connectivity checks in 2622 Section 7 are used with RELOAD without change. 2624 5.4.1.10. Concluding ICE 2626 The controlling agent MUST utilize regular nomination. This is to 2627 ensure consistent state on the final selected pairs without the need 2628 for an updated offer, as RELOAD does not generate additional offer/ 2629 answer exchanges. 2631 The procedures in Section 8 of ICE are followed to conclude ICE, with 2632 the following exceptions: 2634 o The controlling agent MUST NOT attempt to send an updated offer 2635 once the state of its single media stream reaches Completed. 2636 o Once the state of ICE reaches Completed, the agent can immediately 2637 free all unused candidates. This is because RELOAD does not have 2638 the concept of forking, and thus the three second delay in Section 2639 8.3 of ICE does not apply. 2641 5.4.1.11. Subsequent Offers and Answers 2643 An agent MUST NOT send a subsequent offer or answer. Thus, the 2644 procedures in Section 9 of ICE MUST be ignored. 2646 5.4.1.12. Media Keepalives 2648 STUN MUST be utilized for the keepalives described in Section 10 of 2649 ICE. [[ TODO - this does not define what happens for TCP ]] 2651 5.4.1.13. Sending Media 2653 The procedures of Section 11 apply to RELOAD as well. However, in 2654 this case, the "media" takes the form of application layer protocols 2655 (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE 2656 processing completes, the agent will begin TLS or DTLS procedures to 2657 establish a secure connection. The node which sent the Attach 2658 request MUST be the TLS server. The other node MUST be the TLS 2659 client. The nodes MUST verify that the certificate presented in the 2660 handshake matches the identity of the other peer as found in the 2661 Attach message. Once the TLS or DTLS signaling is complete, the 2662 application protocol is free to use the connection. 2664 The concept of a previous selected pair for a component does not 2665 apply to RELOAD, since ICE restarts are not possible with RELOAD. 2667 5.4.1.14. Receiving Media 2669 An agent MUST be prepared to receive packets for the application 2670 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 2671 time. The jitter and RTP considerations in Section 11 of ICE do not 2672 apply to RELOAD or SIP. 2674 5.4.2. AttachLite 2676 An alternative to using the full ICE supported by the Attach request 2677 is to use ICE-Lite with the AttachLite request. This will not work 2678 in all of the scenarios where ICE would work, but in some cases, 2679 particularly those with no NATs or firewalls, it will work. 2680 Configuration for the overlay indicates if this can be used or not. 2682 OPEN ISSUE: We originally envisioned adding support for ICE-Lite 2683 directly to the regular Attach method. However, we found that both 2684 the parameters and processing were completely different, resulting in 2685 almost no overlap between the two methods. Therefore we chose to 2686 separate this out for overlays where the complexities of ICE are not 2687 needed. Note that it is still possible for a node with a public 2688 unfiltered address intending to interoperate to implement Attach 2689 without the candidate gathering phases of ICE and achieve essentially 2690 the same result. If simpler behavior or a better encoding of ICE- 2691 Lite in Attach is developed, such an approach would be preferable. 2693 5.4.2.1. Request Definition 2695 An AttachLiteReq message contains the requesting peer's ICE-Lite 2696 connection parameters formatted into a binary structure. When using 2697 the AttachLite request, both sides act as ICE-Lite hosts. 2699 struct { 2700 IpAddressPort addr_port; 2701 Transport transport; 2702 uint32 priority; 2703 } IceLiteCandidate; 2705 struct { 2706 uint16 application; 2707 IceLiteCandidate candidates<0..2^16-1>; 2708 } AttachLiteReqs; 2710 The values contained in AttachLiteReq are: 2712 application 2713 A 16-bit port number used in the same was as in the Attach 2714 request. This port number represents the IANA registered port of 2715 the protocol that is going to be sent on this connection. 2717 candidates 2718 One or more ICE candidate values. Each one contains an IP address 2719 and family, transport protocol, and port to connect to as well as 2720 a priority. 2722 These values should be generated using the procedures described in 2723 Section 5.4.1.3. 2725 5.4.2.2. Attach-Lite Connectivity Checks 2727 STUN is not used for connectivity checks when doing ICE-Lite, instead 2728 the DTLS or TLS handshake forms the connectivity check. The host 2729 that received the AttachLiteReq MUST initiate TLS or DTLS connections 2730 to candidates provided in the request. When a connection forms, the 2731 node MUST check the certificate is for the node that send 2732 AttachLiteReq and if is not, MUST close the connection. 2734 Since TLS provides the connectivity check, there is no need for the 2735 RFC 4571 [RFC4571] style framing shim for STUN when using TLS and 2736 this is not used for this protocol. 2738 5.4.2.3. Implementation Notes for Attach-Lite 2740 This is a non normative section to help implementors. 2742 At times ICE can seem a bit daunting to gets one head around. For a 2743 simple IPv4 only peer, a simple implementation of Attach-Lite could 2744 be done be doing the following: 2745 o When sending an AttachLiteReq, form one with a candidate with a 2746 priority value of (2^24)*(126)+(2^8)*(65535)+(2^0)*(256-1) that 2747 specifies the UDP port being listened to and another one with the 2748 TCP port. 2749 o When receiving an AttachLiteReq, try to form a connection to each 2750 candidate in the request. Check the certificate receive in the 2751 TLS handshake has the correct Node-ID as the node that send the 2752 AttchLiteReq. If multiple connection succeed, close all but the 2753 one with highest priority. 2754 o Do normal TLS and DTLS with no need for any special framing or 2755 STUN processing. 2757 5.4.3. Ping 2759 Ping is used to test connectivity along a path. A ping can be 2760 addressed to a specific Node-ID, the peer controlling a given 2761 location (by using a resource ID), or to the broadcast Node-ID (all 2762 1s). 2764 5.4.3.1. Request Definition 2766 struct { 2767 } PingReq 2769 5.4.3.2. Response Definition 2771 A successful PingAns response contains the information elements 2772 requested by the peer. 2774 struct { 2775 uint64 response_id; 2776 } PingAns; 2778 A PingAns message contains the following elements: 2780 response_id 2781 A randomly generated 64-bit response ID. This is used to 2782 distinguish Ping responses in cases where the Ping request is 2783 multicast. 2785 5.5. Overlay Link Layer 2787 RELOAD can use multiple Overlay Link protocols to send its messages. 2788 Because ICE is used to establish connections (see Section 5.4.1.3), 2789 RELOAD nodes are able to detect which Overlay Link protocols are 2790 offered by other nodes and establish connections between each other. 2791 Any link protocol needs to be able to establish a secure, 2792 authenticated connection, and provide data origin authentication and 2793 message integrity for individual data elements. RELOAD currently 2794 supports two Overlay Link protocols: 2796 o TLS [TODO REF] over TCP 2797 o DTLS [RFC4347] over UDP 2799 Note that although UDP does not properly have "connections", both TLS 2800 and DTLS have a handshake which establishes a stateful association, a 2801 similar stateful construct, and we simply refer to these as 2802 "connections" for the purposes of this document. 2804 5.5.1. Future Support for HIP 2806 The P2PSIP Working Group has expressed interest in supporting a HIP- 2807 based link protocol. Such support would require specifying such 2808 details as: 2810 o How to issue certificates which provided identities meaningful to 2811 the HIP base exchange. We anticipate that this would require a 2812 mapping between ORCHIDs and NodeIds. 2813 o How to carry the HIP I1 and I2 messages. We anticipate that this 2814 would require defining a HIP Tunnel usage. 2815 o How to carry RELOAD messages over HIP. 2817 We leave this work as a topic for another draft. 2819 5.5.2. Reliability for Unreliable Links 2821 When RELOAD is carried over DTLS or another unreliable link protocol, 2822 it needs to be used with a reliability and congestion control 2823 mechanism, which is provided on a hop-by-hop basis, matching the 2824 semantics if TCP were used. The basic principle is that each 2825 message, regardless of if it carries a request or responses, will get 2826 an ACK and be reliably retransmitted. The receiver's job is very 2827 simple, limited to just sending ACKs. All the complexity is at the 2828 sender side. This allows the sending implementation to trade off 2829 performance versus implementation complexity without affecting the 2830 wire protocol. 2832 In order to support unreliable links, each message is wrapped in a 2833 very simple framing layer (FramedMessage) which is only used for each 2834 hop. This layer contains a sequence number which can then be used 2835 for ACKs. 2837 5.5.2.1. Framed Message Format 2839 The definition of FramedMessage is: 2841 enum {data (128), ack (129), (255)} FramedMessageType; 2843 struct { 2844 FramedMessageType type; 2846 select (type) { 2847 case data: 2848 uint24 sequence; 2849 opaque message<0..2^24-1>; 2851 case ack: 2852 uint24 ack_sequence; 2853 uint32 received; 2854 }; 2856 } FramedMessage; 2858 The type field of the PDU is set to indicate whether the message is 2859 data or an acknowledgement. Note that these values have been set to 2860 force the first bit to be high, thus allowing easy demultiplexing 2861 with STUN. All FramedMessageType values must be > 128. 2863 If the message is of type "data", then the remainder of the PDU is as 2864 follows: 2866 sequence 2867 the sequence number 2869 message 2870 the original message that is being transmitted. 2872 Each connection has it own sequence number. Initially the value is 2873 zero and it increments by exactly one for each message sent over that 2874 connection. 2876 When the receiver receive a message, it SHOULD immediately send an 2877 ACK message. The receiver MUST keep track of the 32 most recent 2878 sequence numbers received on this association in order to generate 2879 the appropriate ack. 2881 If the PDU is of type "ack", the contents are as follows: 2883 ack_sequence 2884 The sequence number of the message being acknowledged. 2886 received 2887 A bitmask indicating whether or not each of the previous 32 2888 packets has been received before the sequence number in 2889 ack_sequence. The high order bit represents the first packet in 2890 the sequence space. 2892 The received field bits in the ACK provide a very high degree of 2893 redundancy for the sender to figure out which packets the receiver 2894 received and can then estimate packet loss rates. If the sender also 2895 keeps track of the time at which recent sequence numbers were sent, 2896 the RTT can be estimated. 2898 5.5.2.2. Retransmission and Flow Control 2900 Because the receiver's role is limited to providing packet 2901 acknowledgements, a wide variety of congestion control algorithms can 2902 be implemented on the sender side while using the same basic wire 2903 protocol. Senders MUST implement a retransmission and congestion 2904 control scheme no more aggressive then TFRC[RFC5348]. One way to do 2905 that is for senders to implement TFRC-SP [RFC4828] and use the 2906 received bitmask to allow the sender to compute packet loss event 2907 rates. 2909 5.5.3. Fragmentation and Reassembly 2911 In order to allow transmission over datagram protocols, RELOAD 2912 messages may be fragmented. If a message is too large for a peer to 2913 transmit to the next peer it MUST fragment the message. Note that 2914 this implies that intermediate peers may re-fragment messages if the 2915 incoming and outgoing paths have different maximum datagram sizes. 2916 Intermediate peers SHOULD NOT reassemble fragments. 2918 Upon receipt of a fragmented message by the intended peer, the peer 2919 holds the fragments in a holding buffer until the entire message has 2920 been received. The message is then reassembled into a single 2921 unfragmented message and processed. In order to mitigate denial of 2922 service attacks, receivers SHOULD time out incomplete fragments. 2923 [[TODO: Describe algorithm]] 2925 6. Data Storage Protocol 2927 RELOAD provides a set of generic mechanisms for storing and 2928 retrieving data in the Overlay Instance. These mechanisms can be 2929 used for new applications simply by defining new code points and a 2930 small set of rules. No new protocol mechanisms are required. 2932 The basic unit of stored data is a single StoredData structure: 2934 struct { 2935 uint32 length; 2936 uint64 storage_time; 2937 uint32 lifetime; 2938 StoredDataValue value; 2939 Signature signature; 2940 } StoredData; 2942 The contents of this structure are as follows: 2944 length 2945 The length of the rest of the structure in octets. 2947 storage_time 2948 The time when the data was stored in absolute time, represented in 2949 seconds since the Unix epoch. Any attempt to store a data value 2950 with a storage time before that of a value already stored at this 2951 location MUST generate a Error_Data_Too_Old error. This prevents 2952 rollback attacks. Note that this does not require synchronized 2953 clocks: the receiving peer uses the storage time in the previous 2954 store, not its own clock. 2956 lifetime 2957 The validity period for the data, in seconds, starting from the 2958 time of store. 2960 value 2961 The data value itself, as described in Section 6.2. 2963 signature 2964 A signature over the data value. Section 6.1 describes the 2965 signature computation. The element is formatted as described in 2966 Section 5.2.4 2968 Each Resource-ID specifies a single location in the Overlay Instance. 2969 However, each location may contain multiple StoredData values 2970 distinguished by Kind-ID. The definition of a kind describes both 2971 the data values which may be stored and the data model of the data. 2972 Some data models allow multiple values to be stored under the same 2973 Kind-ID. Section Section 6.2 describes the available data models. 2974 Thus, for instance, a given Resource-ID might contain a single-value 2975 element stored under Kind-ID X and an array containing multiple 2976 values stored under Kind-ID Y. 2978 6.1. Data Signature Computation 2980 Each StoredData element is individually signed. However, the 2981 signature also must be self-contained and cover the Kind-ID and 2982 Resource-ID even though they are not present in the StoredData 2983 structure. The input to the signature algorithm is: 2985 resource_id + kind + StoredData 2987 Where these values are: 2989 resource 2990 The resource ID where this data is stored. 2992 kind 2993 The Kind-ID for this data. 2995 StoredData 2996 The contents of the stored data value, as described in the 2997 previous sections. 2999 [OPEN ISSUE: Should we include the identity in the string that forms 3000 the input to the signature algorithm?.] 3002 Once the signature has been computed, the signature is represented 3003 using a signature element, as described in Section 5.2.4. 3005 6.2. Data Models 3007 The protocol currently defines the following data models: 3009 o single value 3010 o array 3011 o dictionary 3013 These are represented with the StoredDataValue structure: 3015 enum { reserved(0), single_value(1), array(2), 3016 dictionary(3), (255)} DataModel; 3018 struct { 3019 Boolean exists; 3020 opaque value<0..2^32-1>; 3021 } DataValue; 3023 struct { 3024 DataModel model; 3026 select (model) { 3027 case single_value: 3028 DataValue single_value_entry; 3030 case array: 3031 ArrayEntry array_entry; 3033 case dictionary: 3034 DictionaryEntry dictionary_entry; 3036 /* This structure may be extended */ 3037 } ; 3038 } StoredDataValue; 3040 We now discuss the properties of each data model in turn: 3042 6.2.1. Single Value 3044 A single-value element is a simple, opaque sequence of bytes. There 3045 may be only one single-value element for each Resource-ID, Kind-ID 3046 pair. 3048 A single value element is represented as a DataValue, which contains 3049 the following two elements: 3051 exists 3052 This value indicates whether the value exists at all. If it is 3053 set to False, it means that no value is present. If it is True, 3054 that means that a value is present. This gives the protocol a 3055 mechanism for indicating nonexistence as opposed to emptiness. 3057 value 3058 The stored data. 3060 6.2.2. Array 3062 An array is a set of opaque values addressed by an integer index. 3063 Arrays are zero based. Note that arrays can be sparse. For 3064 instance, a Store of "X" at index 2 in an empty array produces an 3065 array with the values [ NA, NA, "X"]. Future attempts to fetch 3066 elements at index 0 or 1 will return values with "exists" set to 3067 False. 3069 A array element is represented as an ArrayEntry: 3071 struct { 3072 uint32 index; 3073 DataValue value; 3074 } ArrayEntry; 3076 The contents of this structure are: 3078 index 3079 The index of the data element in the array. 3081 value 3082 The stored data. 3084 6.2.3. Dictionary 3086 A dictionary is a set of opaque values indexed by an opaque key with 3087 one value for each key. A single dictionary entry is represented as 3088 follows 3090 A dictionary element is represented as a DictionaryEntry: 3092 typedef opaque DictionaryKey<0..2^16-1>; 3094 struct { 3095 DictionaryKey key; 3096 DataValue value; 3097 } DictionaryEntry; 3099 The contents of this structure are: 3101 key 3102 The dictionary key for this value. 3104 value 3105 The stored data. 3107 6.3. Data Storage Methods 3109 RELOAD provides several methods for storing and retrieving data: 3111 o Store values in the overlay 3112 o Fetch values from the overlay 3113 o Remove values from the overlay 3114 o Find the values stored at an individual peer 3116 These methods are each described in the following sections. 3118 6.3.1. Store 3120 The Store method is used to store data in the overlay. The format of 3121 the Store request depends on the data model which is determined by 3122 the kind. 3124 6.3.1.1. Request Definition 3126 A StoreReq message is a sequence of StoreKindData values, each of 3127 which represents a sequence of stored values for a given kind. The 3128 same Kind-ID MUST NOT be used twice in a given store request. Each 3129 value is then processed in turn. These operations MUST be atomic. 3130 If any operation fails, the state MUST be rolled back to before the 3131 request was received. 3133 The store request is defined by the StoreReq structure: 3135 struct { 3136 KindId kind; 3137 DataModel data_model; 3138 uint64 generation_counter; 3139 StoredData values<0..2^32-1>; 3140 } StoreKindData; 3142 struct { 3143 ResourceId resource; 3144 uint8 replica_number; 3145 StoreKindData kind_data<0..2^32-1>; 3146 } StoreReq; 3148 A single Store request stores data of a number of kinds to a single 3149 resource location. The contents of the structure are: 3151 resource 3152 The resource to store at. 3154 replica_number 3155 The number of this replica. When a storing peer saves replicas to 3156 other peers each peer is assigned a replica number starting from 1 3157 and sent in the Store message. This field is set to 0 when a node 3158 is storing its own data. This allows peers to distinguish replica 3159 writes from original writes. 3161 kind_data 3162 A series of elements, one for each kind of data to be stored. 3164 If the replica number is zero, then the peer MUST check that it is 3165 responsible for the resource and if not reject the request. If the 3166 replica number is nonzero, then the peer MUST check that it expects 3167 to be a replica for the resource and if not reject the request. 3169 Each StoreKindData element represents the data to be stored for a 3170 single Kind-ID. The contents of the element are: 3172 kind 3173 The Kind-ID. Implementations SHOULD reject requests corresponding 3174 to unknown kinds unless specifically configured otherwise. 3176 data_model 3177 The data model of the data. The kind defines what this has to be 3178 so this is redundant in the case where the software interpreting 3179 the messages understands the kind. 3181 generation 3182 The expected current state of the generation counter 3183 (approximately the number of times this object has been written, 3184 see below for details). 3186 values 3187 The value or values to be stored. This may contain one or more 3188 stored_data values depending on the data model associated with 3189 each kind. 3191 The peer MUST perform the following checks: 3193 o The kind_id is known and supported. 3195 o The data_model matches the kind_id. 3196 o The signatures over each individual data element (if any) are 3197 valid. 3198 o Each element is signed by a credential which is authorized to 3199 write this kind at this Resource-ID 3200 o For original (non-replica) stores, the peer MUST check that if the 3201 generation-counter is non-zero, it equals the current value of the 3202 generation-counter for this kind. This feature allows the 3203 generation counter to be used in a way similar to the HTTP Etag 3204 feature. 3205 o The storage time values are greater than that of any value which 3206 would be replaced by this Store. [[OPEN ISSUE: do peers need to 3207 save the storage time of Removes to prevent reinsertion?]] 3209 If all these checks succeed, the peer MUST attempt to store the data 3210 values. For non-replica stores, if the store succeeds and the data 3211 is changed, then the peer must increase the generation counter by at 3212 least one. If there are multiple stored values in a single 3213 StoreKindData, it is permissible for the peer to increase the 3214 generation counter by only 1 for the entire Kind-ID, or by 1 or more 3215 than one for each value. Accordingly, all stored data values must 3216 have a generation counter of 1 or greater. 0 is used by other nodes 3217 to indicate that they are indifferent to the generation counter's 3218 current value. For replica Stores, the peer MUST set the generation 3219 counter to match the generation_counter in the message. Replica 3220 Stores MUST NOT use a generation counter of 0. 3222 The properties of stores for each data model are as follows: 3224 Single-value: 3225 A store of a new single-value element creates the element if it 3226 does not exist and overwrites any existing value with the new 3227 value. 3229 Array: 3230 A store of an array entry replaces (or inserts) the given value at 3231 the location specified by the index. Because arrays are sparse, a 3232 store past the end of the array extends it with nonexistent values 3233 (exists=False) as required. A store at index 0xffffffff places 3234 the new value at the end of the array regardless of the length of 3235 the array. The resulting StoredData has the correct index value 3236 when it is subsequently fetched. 3238 Dictionary: 3240 A store of a dictionary entry replaces (or inserts) the given 3241 value at the location specified by the dictionary key. 3243 The following figure shows the relationship between these structures 3244 for an example store which stores the following values at resource 3245 "1234" 3247 o The value "abc" in the single value slot for kind X 3248 o The value "foo" at index 0 in the array for kind Y 3249 o The value "bar" at index 1 in the array for kind Y 3251 Store 3252 resource=1234 3253 / \ 3254 / \ 3255 StoreKindData StoreKindData 3256 kind=X kind=Y 3257 model=Single-Value model=Array 3258 | /\ 3259 | / \ 3260 StoredData / \ 3261 | / \ 3262 | StoredData StoredData 3263 StoredDataValue | | 3264 value="abc" | | 3265 | | 3266 StoredDataValue StoredDataValue 3267 index=0 index=1 3268 value="foo" value="bar" 3270 6.3.1.2. Response Definition 3272 In response to a successful Store request the peer MUST return a 3273 StoreAns message containing a series of StoreKindResponse elements 3274 containing the current value of the generation counter for each 3275 Kind-ID, as well as a list of the peers where the data was 3276 replicated. 3278 struct { 3279 KindId kind; 3280 uint64 generation_counter; 3281 NodeId replicas<0..2^16-1>; 3282 } StoreKindResponse; 3284 struct { 3285 StoreKindResponse kind_responses<0..2^16-1>; 3287 } StoreAns; 3289 The contents of each StoreKindResponse are: 3291 kind 3292 The Kind-ID being represented. 3294 generation 3295 The current value of the generation counter for that Kind-ID. 3297 replicas 3298 The list of other peers at which the data was/will-be replicated. 3299 In overlays and applications where the responsible peer is 3300 intended to store redundant copies, this allows the storing peer 3301 to independently verify that the replicas were in fact stored by 3302 doing its own Fetch. 3304 The response itself is just StoreKindResponse values packed end-to- 3305 end. 3307 If any of the generation counters in the request precede the 3308 corresponding stored generation counter, then the peer MUST fail the 3309 entire request and respond with a Error_Data_Too_Old error. The 3310 error_info in the ErrorResponse MUST be a StoreAns response 3311 containing the correct generation counter for each kind and empty 3312 replicas lists. [[ TODO need to fix this up in better way ]] 3314 If the data being stored is too large for the allowed limit by the 3315 given usage, then the peer MUST fail the request and generate an 3316 Error_Data_Too_Larg error. 3318 6.3.2. Fetch 3320 The Fetch request retrieves one or more data elements stored at a 3321 given Resource-ID. A single Fetch request can retrieve multiple 3322 different kinds. 3324 6.3.2.1. Request Definition 3326 struct { 3327 int32 first; 3328 int32 last; 3329 } ArrayRange; 3331 struct { 3332 KindId kind; 3333 DataModel model; 3334 uint64 generation; 3335 uint16 length; 3337 select (model) { 3338 case single_value: ; /* Empty */ 3340 case array: 3341 ArrayRange indices<0..2^16-1>; 3343 case dictionary: 3344 DictionaryKey keys<0..2^16-1>; 3346 /* This structure may be extended */ 3348 } model_specifier; 3349 } StoredDataSpecifier; 3351 struct { 3352 ResourceId resource; 3353 StoredDataSpecifier specifiers<0..2^16-1>; 3354 } FetchReq; 3356 The contents of the Fetch requests are as follows: 3358 resource 3359 The resource ID to fetch from. 3361 specifiers 3362 A sequence of StoredDataSpecifier values, each specifying some of 3363 the data values to retrieve. 3365 Each StoredDataSpecifier specifies a single kind of data to retrieve 3366 and (if appropriate) the subset of values that are to be retrieved. 3367 The contents of the StoredDataSpecifier structure are as follows: 3369 kind 3370 The Kind-ID of the data being fetched. Implementations SHOULD 3371 reject requests corresponding to unknown kinds unless specifically 3372 configured otherwise. 3374 model 3375 The data model of the data. This must be checked against the 3376 Kind-ID. 3378 generation 3379 The last generation counter that the requesting peer saw. This 3380 may be used to avoid unnecessary fetches or it may be set to zero. 3382 length 3383 The length of the rest of the structure, thus allowing 3384 extensibility. 3386 model_specifier 3387 A reference to the data value being requested within the data 3388 model specified for the kind. For instance, if the data model is 3389 "array", it might specify some subset of the values. 3391 The model_specifier is as follows: 3393 o If the data is of data model single value, the specifier is empty. 3394 o If the data is of data model array, the specifier contains of a 3395 list of ArrayRange elements, each of which contains two integers. 3396 The first integer is the beginning of the range and the second is 3397 the end of the range. 0 is used to indicate the first element and 3398 0xffffffff is used to indicate the final element. The beginning 3399 of the range MUST be earlier in the array then the end. The 3400 ranges MUST be non-overlapping. 3401 o If the data is of data model dictionary then the specifier 3402 contains a list of the dictionary keys being requested. If no 3403 keys are specified, than this is a wildcard fetch and all key- 3404 value pairs are returned. [[TODO: We really need a way to return 3405 only the keys. We'll need to modify this.]] 3407 The generation-counter is used to indicate the requester's expected 3408 state of the storing peer. If the generation-counter in the request 3409 matches the stored counter, then the storing peer returns a response 3410 with no StoredData values. 3412 Note that because the certificate for a user is typically stored at 3413 the same location as any data stored for that user, a requesting peer 3414 which does not already have the user's certificate should request the 3415 certificate in the Fetch as an optimization. 3417 6.3.2.2. Response Definition 3419 The response to a successful Fetch request is a FetchAns message 3420 containing the data requested by the requester. 3422 struct { 3423 KindId kind; 3424 uint64 generation; 3425 StoredData values<0..2^32-1>; 3426 } FetchKindResponse; 3428 struct { 3429 FetchKindResponse kind_responses<0..2^32-1>; 3430 } FetchAns; 3432 The FetchAns structure contains a series of FetchKindResponse 3433 structures. There MUST be one FetchKindResponse element for each 3434 Kind-ID in the request. 3436 The contents of the FetchKindResponse structure are as follows: 3438 kind 3439 the kind that this structure is for. 3441 generation 3442 the generation counter for this kind. 3444 values 3445 the relevant values. If the generation counter in the request 3446 matches the generation-counter in the stored data, then no 3447 StoredData values are returned. Otherwise, all relevant data 3448 values MUST be returned. A nonexistent value is represented with 3449 "exists" set to False. 3451 There is one subtle point about signature computation on arrays. If 3452 the storing node uses the append feature (where the 3453 index=0xffffffff), then the index in the StoredData that is returned 3454 will not match that used by the storing node, which would break the 3455 signature. In order to avoid this issue, the index value in array is 3456 set to zero before the signature is computed. This implies that 3457 malicious storing nodes can reorder array entries without being 3458 detected. [[OPEN ISSUE: We've considered a number of alternate 3459 designs here that would preserve security against this attack if the 3460 storing node did not use the append feature. However, they are more 3461 complicated for one or both sides. If this attack is considered 3462 serious, we can introduce one of them.]] 3464 6.3.3. Stat 3466 The Stat request is used to get metadata (length, generation counter, 3467 digest, etc.) for a stored element without retrieving the element 3468 itself. The name is from the UNIX stat(2) system call which performs 3469 a similar function for files in a filesystem. It also allows the 3470 requesting node to get a list of matching elements without requesting 3471 the entire element. 3473 6.3.3.1. Request Definition 3475 The Stat request is identical to the Fetch request. It simply 3476 specifies the elements to get metadata about. 3478 struct { 3479 ResourceId resource; 3480 StoredDataSpecifier specifiers<0..2^16-1>; 3481 } StatReq; 3483 6.3.3.2. Response Definition 3485 The Stat response contains the same sort of entries that a Fetch 3486 response would contain, however instead of containing the element 3487 data it contains metadata. 3489 struct { 3490 Boolean exists; 3491 uint32 value_length; 3492 HashAlgorithm hash_algorithm; 3493 opaque hash_value<0..255>; 3494 } MetaData; 3496 struct { 3497 uint32 index; 3498 MetaData value; 3499 } ArrayEntryMeta; 3501 struct { 3502 DictionaryKey key; 3503 MetaData value; 3504 } DictionaryEntryMeta; 3506 struct { 3507 DataModel model; 3508 select (model) { 3509 case single_value: 3510 MetaData single_value_entry; 3512 case array: 3513 ArrayEntryMeta array_entry; 3515 case dictionary: 3516 DictionaryEntryMeta dictionary_entry; 3518 /* This structure may be extended */ 3519 } ; 3520 } MetaDataValue; 3522 struct { 3523 uint32 length; 3524 uint64 storage_time; 3525 uint32 lifetime; 3526 MetaDataValue metadata; 3527 } StoredMetaData; 3529 struct { 3530 KindId kind; 3531 uint64 generation; 3532 StoredMetaData values<0..2^32-1>; 3533 } StatKindResponse; 3535 struct { 3536 StatKindResponse kind_responses<0..2^32-1>; 3537 } StatAns; 3539 The structures used in StatAns parallel those used in FetchAns: a 3540 response consists of multiple StatKindResponse values, one for each 3541 kind that was in the request. The contents of the StatKindResponse 3542 are the same as those in the FetchKindResponse, except that the 3543 values list contains StoredMetaData entries instead of StoredData 3544 entries. 3546 The contents of the StoredMetaData structure are the same as the 3547 corresponding fields in StoredData except that there is no signature 3548 field and the value is a MetaDataValue rather than a StoredDataValue. 3550 A MetaDataValue is a variant structure, like a StoredDataValue, 3551 except for the types of each arm, which replace DataValue with 3552 MetaData. 3554 The only really new structure is MetaData, which has the following 3555 contents: 3557 exists 3558 Same as in DataValue 3560 value_length 3561 The length of the stored value. 3563 hash_algorithm 3564 The hash algorithm used to perform the digest of the value. 3566 hash_value 3567 A digest of the value using hash_algorithm. 3569 6.3.4. Remove 3571 The Remove request is used to remove a stored element or elements 3572 from the storing peer. Any successful remove of an existing element 3573 for a given kind MUST increment the generation counter by at least 1. 3575 struct { 3576 ResourceId resource; 3577 StoredDataSpecifier specifiers<0..2^16-1>; 3578 } RemoveReq; 3580 A RemoveReq has exactly the same syntax as a Fetch request except 3581 that each entry represents a set of values to be removed rather than 3582 returned. The same Kind-ID MUST NOT be used twice in a given 3583 RemoveReq. Each specifier is then processed in turn. These 3584 operations MUST be atomic. If any operation fails, the state MUST be 3585 rolled back to before the request was received. 3587 Before processing the Remove request, the peer MUST perform the 3588 following checks. 3590 o The Kind-ID is known. 3591 o The signature over the message is valid or (depending on overlay 3592 policy) no signature is required. 3593 o The signer of the message has permissions which permit him to 3594 remove this kind of data. Although each kind defines its own 3595 access control requirements, in general only the original signer 3596 of the data should be allowed to remove it. 3597 o If the generation-counter is non-zero, it must equal the current 3598 value of the generation-counter for this kind. This feature 3599 allows the generation counter to be used in a way similar to the 3600 HTTP Etag feature. 3602 Assuming that the request is permitted, the operations proceed as 3603 follows. 3605 6.3.4.1. Single Value 3607 A Remove of a single value element causes it not to exist. If no 3608 such element exists, then this is a silent success. 3610 6.3.4.2. Array 3612 A Remove of an array element (or element range) replaces those 3613 elements with null elements. Note that this does not cause the array 3614 to be packed. An array which contains ["A", "B", "C"] and then has 3615 element 0 removed produces an array containing [NA, "B", "C"]. Note, 3616 however, that the removal of the final element of the array shortens 3617 the array, so in the above case, the removal of element 2 makes the 3618 array ["A", "B"]. 3620 6.3.4.3. Dictionary 3622 A Remove of a dictionary element (or elements) replaces those 3623 elements with null elements. If no such elements exist, then this is 3624 a silent success. 3626 6.3.4.4. Response Definition 3628 The response to a successful Remove simply contains a list of the new 3629 generation counters for each Kind-ID, using the same syntax as the 3630 response to a Store request. Note that if the generation counter 3631 does not change, that means that the requested items did not exist. 3632 However, if the generation counter does change, that does not mean 3633 that the items existed. 3635 struct { 3636 StoreKindResponse kind_responses<0..2^16-1>; 3637 } RemoveAns; 3639 6.3.5. Find 3641 The Find request can be used to explore the Overlay Instance. A Find 3642 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 3643 (if any) of the resource of kind T known to the target peer which is 3644 closes to R. This method can be used to walk the Overlay Instance by 3645 interactively fetching R_n+1=nearest(1 + R_n). 3647 6.3.5.1. Request Definition 3649 The FindReq message contains a series of Resource-IDs and Kind-IDs 3650 identifying the resource the peer is interested in. 3652 struct { 3653 ResourceID resource; 3654 KindId kinds<0..2^8-1>; 3655 } FindReq; 3657 The request contains a list of Kind-IDs which the Find is for, as 3658 indicated below: 3660 resource 3661 The desired Resource-ID 3663 kinds 3664 The desired Kind-IDs. Each value MUST only appear once. 3666 6.3.5.2. Response Definition 3668 A response to a successful Find request is a FindAns message 3669 containing the closest Resource-ID for each kind specified in the 3670 request. 3672 struct { 3673 KindId kind; 3674 ResourceID closest; 3675 } FindKindData; 3677 struct { 3678 FindKindData results<0..2^16-1>; 3679 } FindAns; 3681 If the processing peer is not responsible for the specified 3682 Resource-ID, it SHOULD return a 404 error. 3684 For each Kind-ID in the request the response MUST contain a 3685 FindKindData indicating the closest Resource-ID for that Kind-ID 3686 unless the kind is not allowed to be used with Find in which case a 3687 FindKindData for that Kind-ID MUST NOT be included in the response. 3688 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 3689 0. Note that different Kind-IDs may have different closest Resource- 3690 IDs. 3692 The response is simply a series of FindKindData elements, one per 3693 kind, concatenated end-to-end. The contents of each element are: 3695 kind 3696 The Kind-ID. 3698 closest 3699 The closest resource ID to the specified resource ID. This is 0 3700 if no resource ID is known. 3702 Note that the response does not contain the contents of the data 3703 stored at these Resource-IDs. If the requester wants this, it must 3704 retrieve it using Fetch. 3706 6.3.6. Defining New Kinds 3708 TODO: is this the right place in the document for this? 3710 A new kind MUST define: 3712 o The meaning of the data to be stored. 3713 o The Kind-ID. 3714 o The data model (single value, array, dictionary, etc.) 3715 o Access control rules for indicating what credentials are allowed 3716 to read and write that Kind-ID at a given location. 3718 While each kind MUST define what data model is used for its data, 3719 that does not mean that it must define new data models. Where 3720 practical, kinds SHOULD use the built-in data models. However, they 3721 MAY define any new required data models. The intention is that the 3722 basic data model set be sufficient for most applications/usages. 3724 7. Certificate Store Usage 3726 The Certificate Store usage allows a peer to store its certificate in 3727 the overlay, thus avoiding the need to send a certificate in each 3728 message - a reference may be sent instead. 3730 A user/peer MUST store its certificate at Resource-IDs derived from 3731 two Resource Names: 3733 o The user name in the certificate. 3734 o The Node-ID in the certificate. 3736 Note that in the second case the certificate is not stored at the 3737 peer's Node-ID but rather at a hash of the peer's Node-ID. The 3738 intention here (as is common throughout RELOAD) is to avoid making a 3739 peer responsible for its own data. 3741 A peer MUST ensure that the user's certificates are stored in the 3742 Overlay Instance. New certificates are stored at the end of the 3743 list. This structure allows users to store and old and new 3744 certificate the both have the same Node-ID which allows for migration 3745 of certificates when they are renewed. 3747 Kind IDs This usage defines the CERTIFICATE Kind-ID to store a peer 3748 or user's certificate. 3750 Data Model The data model for CERTIFICATE data is array. 3752 Access Control The CERTIFICATE MUST contain a Node-ID or user name 3753 which, when hashed, maps to the Resource-ID at which the value is 3754 being stored. 3756 8. TURN Server Usage 3758 The TURN server usage allows a RELOAD peer to advertise that it is 3759 prepared to be a TURN server as defined in [I-D.ietf-behave-turn]. 3760 When a node starts up, it joins the overlay network and forms several 3761 connection in the process. If the ICE stage in any of these 3762 connection return a reflexive address that is not the same as the 3763 peers perceived address, then the peers is behind a NAT and not an 3764 candidate for a TURN server. Additionally, if the peers IP address 3765 is in the private address space range, then it is not a candidate for 3766 a TURN server. Otherwise, the peer SHOULD assume it is a potential 3767 TURN server and follow the procedures below. 3769 If the node is a candidate for a TURN server it will insert some 3770 pointers in the overlay so that other peers can find it. The overlay 3771 configuration file specifies a turnDensity parameter that indicates 3772 how many times each TURN server should record itself in the overlay. 3773 Typically this should be set to the reciprocal of the estimate of 3774 what percentage of peers will act as TURN servers. For each value, 3775 called d, between 1 and turnDensity, the peer forms a Resource Name 3776 by concatenating its Peer-ID and the value d. This Resource Name is 3777 hashed to form a Resource-ID. The address of the peer is stored at 3778 that Resource-ID using type TURN-SERVICE and the TurnServer object: 3780 struct { 3781 uint8 iteration; 3782 IpAddressAndPort server_address; 3783 } TurnServer; 3785 The contents of this structure are as follows: 3787 iteration 3788 the d value 3790 server_address 3791 the address at which the TURN server can be contacted. 3793 Note: Correct functioning of this algorithm depends critically on 3794 having turnDensity be an accurate estimate of the true density of 3795 TURN servers. If turnDensity is too high, then the process of 3796 finding TURN servers becomes extremely expensive as multiple 3797 candidate Resource-IDs must be probed. 3799 Peers peers that provide this service need to support the TURN 3800 extensions to STUN for media relay of both UDP and TCP traffic as 3801 defined in [I-D.ietf-behave-turn] and [RFC5382]. 3803 [[OPEN ISSUE: This structure only works for TURN servers that have 3804 public addresses. It may be possible to use TURN servers that are 3805 behind well-behaved NATs by first ICE connecting to them. If we 3806 decide we want to enable that, this structure will need to change to 3807 either be a Peer-ID or include that as an option.]] 3809 Kind IDs This usage defines the TURN-SERVICE Kind-ID to indicate 3810 that a peer is willing to act as a TURN server. The Find command 3811 MUST return results for the TURN-SERVICE Kind-ID. 3812 Data Model The TURN-SERVICE stores a single value for each 3813 Resource-ID. 3814 Access Control If certificate-based access control is being used, 3815 stored data of kind TURN-SERVICE MUST be authenticated by a 3816 certificate which contains a Peer-ID which when hashed with the 3817 iteration counter produces the Resource-ID being stored at. 3819 Peers can find other servers by selecting a random Resource-ID and 3820 then doing a Find request for the appropriate server type with that 3821 Resource-ID. The Find request gets routed to a random peer based on 3822 the Resource-ID. If that peer knows of any servers, they will be 3823 returned. The returned response may be empty if the peer does not 3824 know of any servers, in which case the process gets repeated with 3825 some other random Resource-ID. As long as the ratio of servers 3826 relative to peers is not too low, this approach will result in 3827 finding a server relatively quickly. 3829 9. Diagnostic Usage 3831 The Diagnostic Usage allows a node to report various statistics about 3832 itself that may be useful for diagnostics or performance management. 3833 It can be used to discover information such as the software version, 3834 uptime, routing table, stored resource-objects, and performance 3835 statistics of a peer. The usage defines several new kinds which can 3836 be retrieved to get the statistics and also allows to retrieve other 3837 kinds that a node stores. In essence, the usage allows querying a 3838 node's state such as storage and network to obtain the relevant 3839 information. Additional diagnostic capabilities have been proposed 3840 in [I-D.zheng-p2psip-diagnose]. 3842 The access control model for all kinds is a local policy defined by 3843 the peer or the overlay policy. The peer may be configured with a 3844 list of users that it is willing to return the information for and 3845 restrict access to users with that name. Unless specific policy 3846 overrides it, data SHOULD NOT be returned for users not on the list. 3847 The access control can also be determined on a per kind basis - for 3848 example, a node may be willing to return the software version to any 3849 users while specific information about performance may not be 3850 returned. 3852 TODO - need to explain how this is addressed to node-id. [TODO: Do 3853 we need a DIAGNOSTIC method? Access control mechanisms for 3854 DIAGNOSTIC may be different from a Fetch.] 3856 The following kinds are defined: 3858 ROUTING_TABLE_SIZE A single value element containing an unsigned 32- 3859 bit integer representing the number of peers in the peer's routing 3860 table. 3862 SOFTWARE_VERSION A single value element containing a US-ASCII string 3863 that identifies the manufacture, model, and version of the 3864 software. 3866 MACHINE_UPTIME A single value element containing an unsigned 64-bit 3867 integer specifying the time the nodes has been up in seconds. 3869 APP_UPTIME A single value element containing an unsigned 64-bit 3870 integer specifying the time the p2p application has been up in 3871 seconds. 3873 MEMORY_FOOTPRINT A single value element containing an unsigned 32- 3874 bit integer representing the memory footprint of the peer program 3875 in kilo bytes. 3877 Note: What's a kilo byte? 1000 or 1024? -- Cullen 3878 Note: Good question. 1000 seems like not quite enough room but 3879 1024 is too much? -- EKR 3881 DATASIZE_STORED An unsigned 64-bit integer representing the number 3882 of bytes of data being stored by this node. 3884 INSTANCES_STORED An array element containing the number of instances 3885 of each kind stored. The array is index by Kind-ID. Each entry 3886 is an unsigned 64-bit integer. 3888 MESSAGES_SENT_RCVD An array element containing the number of 3889 messages sent and received. The array is indexed by method code. 3890 Each entry in the array is a pair of unsigned 64-bit integers 3891 (packed end to end) representing sent and received. 3893 EWMA_BYTES_SENT A single value element containing an unsigned 32-bit 3894 integer representing an exponential weighted average of bytes sent 3895 per second by this peer. 3896 sent = alpha x sent_present + (1 - alpha) x sent 3897 where sent_present represents the bytes sent per second since the 3898 last calculation and sent represents the last calculation of bytes 3899 sent per second. A suitable value for alpha is 0.8. This value 3900 is calculated every five seconds. 3902 EWMA_BYTES_RCVD A single value element containing an unsigned 32-bit 3903 integer representing an exponential weighted average of bytes 3904 received per second by this peer. Same calculation as above. 3906 [[TODO: We would like some sort of bandwidth measurement, but we're 3907 kind of unclear on the units and representation.]] 3909 9.1. Diagnostic Metrics for a P2PSIP Deployment 3911 (OPEN QUESTION: any other metrics?) 3913 Below, we sketch how these metrics can be used. A peer can use 3914 EWMA_BYTES_SENT and EWMA_BYTES_RCVD of another peer to infer whether 3915 it is acting as a media relay. It may then choose not to forward any 3916 requests for media relay to this peer. Similarly, among the various 3917 candidates for filling up routing table, a peer may prefer a peer 3918 with a large UPTIME value, small RTT, and small LAST_CONTACT value. 3920 10. Chord Algorithm 3922 This algorithm is assigned the name chord-128-2-16+ to indicate it is 3923 based on Chord, uses SHA-1 then truncates that to 128 bit for the 3924 hash function, stores 2 redundant copies of all data, and has finger 3925 tables with at least 16 entries. 3927 10.1. Overview 3929 The algorithm described here is a modified version of the Chord 3930 algorithm. Each peer keeps track of a finger table of 16 entries and 3931 a neighborhood table of 6 entries. The neighborhood table contains 3932 the 3 peers before this peer and the 3 peers after it in the DHT 3933 ring. The first entry in the finger table contains the peer half-way 3934 around the ring from this peer; the second entry contains the peer 3935 that is 1/4 of the way around; the third entry contains the peer that 3936 is 1/8th of the way around, and so on. Fundamentally, the chord data 3937 structure can be thought of a doubly-linked list formed by knowing 3938 the successors and predecessor peers in the neighborhood table, 3939 sorted by the Node-ID. As long as the successor peers are correct, 3940 the DHT will return the correct result. The pointers to the prior 3941 peers are kept to enable inserting of new peers into the list 3942 structure. Keeping multiple predecessor and successor pointers makes 3943 it possible to maintain the integrity of the data structure even when 3944 consecutive peers simultaneously fail. The finger table forms a skip 3945 list, so that entries in the linked list can be found in O(log(N)) 3946 time instead of the typical O(N) time that a linked list would 3947 provide. 3949 A peer, n, is responsible for a particular Resource-ID k if k is less 3950 than or equal to n and k is greater than p, where p is the peer id of 3951 the previous peer in the neighborhood table. Care must be taken when 3952 computing to note that all math is modulo 2^128. 3954 10.2. Reactive vs Periodic Recovery 3956 Open Issue: The algorithm currently presented in this section uses 3957 reactive recovery---when a neighbor is lost, that information is 3958 immediately propagated. Research in DHT performance by Rhea et al. 3959 indicates that this is not optimal in large-scale networks with churn 3960 [handling-churn-usenix04]. Addressing this issue, however, needs to 3961 take into account the requirements placed on this algorithm. Because 3962 it is the mandatory DHT for RELOAD, the algorithm described here is 3963 designed to meet two primary challenges: 3964 o Scale from small (ten or fewer) overlays on a LAN to global 3965 overlays with millions of nodes 3966 o Simple to implement 3968 One of the challenges these requirements entail is achieving 3969 reasonable performance as the overlay scales without undue 3970 complexity. We have two possibly conflicting concerns: 3972 o A small-scale overlay may not be stable without reactive recovery, 3973 because a single peer represents a large portion of the overlay. 3974 o A large-scale overlay with significant churn may perform poorly, 3975 both in terms of traffic volume and success rates, when using 3976 reactive recovery. 3977 As a result, multiple solutions have been proposed: 3978 o Identify one set of behaviors that achieves adequate functionality 3979 as the overlay scales. 3980 o Add a parameter dictating the type of recovery used by peers in 3981 the overlay, configuring the peers appropriately as they join the 3982 overlay. 3983 o Make the algorithm adaptive, according to the size of the overlay 3984 or the churn rates observed. 3986 At IETF 72, the WG elected to defer a decision on the final choice 3987 until data could be collected on the effectiveness of the strategies. 3988 This section, therefore, retains the reactive recovery model until 3989 evidence supporting a decision is available. 3991 10.3. Routing 3993 If a peer is not responsible for a Resource-ID k, but is directly 3994 connected to a node with Node-ID k, then it routes the message to 3995 that node. Otherwise, it routes the request to the peer in the 3996 routing table that has the largest Node-ID that is in the interval 3997 between the peer and k. 3999 10.4. Redundancy 4001 When a peer receives a Store request for Resource-ID k, and it is 4002 responsible for Resource-ID k, it stores the data and returns a 4003 success response. [[Open Issue: should it delay sending this 4004 success until it has successfully stored the redundant copies?]]. It 4005 then sends a Store request to its successor in the neighborhood table 4006 and to that peers successor. Note that these Store requests are 4007 addressed to those specific peers, even though the Resource-ID they 4008 are being asked to store is outside the range that they are 4009 responsible for. The peers receiving these check they came from an 4010 appropriate predecessor in their neighborhood table and that they are 4011 in a range that this predecessor is responsible for, and then they 4012 store the data. They do not themselves perform further Stores 4013 because they can determine that they are not responsible for the 4014 Resource-ID. 4016 Note that a malicious node can return a success response but not 4017 store the data locally or in the replica set. Requesting peers that 4018 wish to ensure that the replication actually occurred SHOULD [[Open 4019 Issue: SHOULD or MAY?]] contact each peer listed in the replicas 4020 field of the Store response and retrieve a copy of the data. [[TODO: 4021 Do we want to have some optimization in Fetch where they can retrieve 4022 just a digest instead of the data values?]] 4024 10.5. Joining 4026 The join process for a joining party (JP) with Node-ID n is as 4027 follows. 4029 1. JP connects to its chosen bootstrap node. 4030 2. JP uses a series of Probes to populate its routing table. 4031 3. JP sends Attach requests to initiate connections to each of the 4032 peers in the connection table as well as to the desired finger 4033 table entries. Note that this does not populate their routing 4034 tables, but only their connection tables, so JP will not get 4035 messages that it is expected to route to other nodes. 4036 4. JP enters all the peers it contacted into its routing table. 4037 5. JP sends a Join to its immediate successor, the admitting peer 4038 (AP) for Node-ID n. The AP sends the response to the Join. 4039 6. AP does a series of Store requests to JP to store the data that 4040 JP will be responsible for. 4041 7. AP sends JP an Update explicitly labeling JP as its predecessor. 4042 At this point, JP is part of the ring and responsible for a 4043 section of the overlay. AP can now forget any data which is 4044 assigned to JP and not AP. 4045 8. AP sends an Update to all of its neighbors with the new values of 4046 its neighbor set (including JP). 4047 9. JP sends UpdateS to all the peers in its routing table. 4049 In order to populate its routing table, JP sends a Probe via the 4050 bootstrap node directed at Resource-ID n+1 (directly after its own 4051 Resource-ID). This allows it to discover its own successor. Call 4052 that node p0. It then sends a probe to p0+1 to discover its 4053 successor (p1). This process can be repeated to discover as many 4054 successors as desired. The values for the two peers before p will be 4055 found at a later stage when n receives an Update. 4057 In order to set up its neighbor table entry for peer i, JP simply 4058 sends an Attach to peer (n+2^(numBitsInNodeId-i). This will be 4059 routed to a peer in approximately the right location around the ring. 4061 10.6. Routing Attaches 4063 When a peer needs to Attach to a new peer in its neighborhood table, 4064 it MUST source-route the Attach request through the peer from which 4065 it learned the new peer's Node-ID. Source-routing these requests 4066 allows the overlay to recover from instability. 4068 All other Attach requests, such as those for new finger table 4069 entries, are routed conventionally through the overlay. 4071 If a peer is unable to successfully Attach with a peer that should be 4072 in its neighborhood, it MUST locate either a TURN server or another 4073 peer in the overlay, but not in its neighborhood, through which it 4074 can exchange messages with its neighbor peer 4076 10.7. Updates 4078 A chord Update is defined as 4080 enum { reserved (0), 4081 peer_ready(1), neighbors(2), full(3), (255) } 4082 ChordUpdateType; 4084 struct { 4085 ChordUpdateType type; 4087 select(type){ 4088 case peer_ready: /* Empty */ 4089 ; 4091 case neighbors: 4092 NodeId predecessors<0..2^16-1>; 4093 NodeId successors<0..2^16-1>; 4095 case full: 4096 NodeId predecessors<0..2^16-1>; 4097 NodeId successors<0..2^16-1>; 4098 NodeId fingers<0..2^16-1>; 4099 }; 4100 } ChordUpdate; 4102 The "type" field contains the type of the update, which depends on 4103 the reason the update was sent. 4105 peer_ready: this peer is ready to receive messages. This message 4106 is used to indicate that a node which has Attached is a peer and 4107 can be routed through. It is also used as a connectivity check to 4108 non-neighbor pers. 4109 neighbors: this version is sent to members of the Chord neighbor 4110 table. 4112 full: this version is sent to peers which request an Update with a 4113 RouteQueryReq. 4115 If the message is of type "neighbors", then the contents of the 4116 message will be: 4118 predecessors 4119 The predecessor set of the Updating peer. 4121 successors 4122 The successor set of the Updating peer. 4124 If the message is of type "full", then the contents of the message 4125 will be: 4127 predecessors 4128 The predecessor set of the Updating peer. 4130 successors 4131 The successor set of the Updating peer. 4133 fingers 4134 The finger table if the Updating peer, in numerically ascending 4135 order. 4137 A peer MUST maintain an association (via Attach) to every member of 4138 its neighbor set. A peer MUST attempt to maintain at least three 4139 predecessors and three successors. However, it MUST send its entire 4140 set in any Update message sent to neighbors. 4142 10.7.1. Sending Updates 4144 Every time a connection to a peer in the neighborhood set is lost (as 4145 determined by connectivity probes or failure of some request), the 4146 peer should remove the entry from its neighborhood table and replace 4147 it with the best match it has from the other peers in its routing 4148 table. It then sends an Update to all its remaining neighbors. The 4149 update will contain all the Node-IDs of the current entries of the 4150 table (after the failed one has been removed). Note that when 4151 replacing a successor the peer SHOULD delay the creation of new 4152 replicas for 30 seconds after removing the failed entry from its 4153 neighborhood table in order to allow a triggered update to inform it 4154 of a better match for its neighborhood table. 4156 If connectivity is lost to all three of the peers that succeed this 4157 peer in the ring, then this peer should behave as if it is joining 4158 the network and use Probes to find a peer and send it a Join. If 4159 connectivity is lost to all the peers in the finger table, this peer 4160 should assume that it has been disconnected from the rest of the 4161 network, and it should periodically try to join the DHT. 4163 10.7.2. Receiving Updates 4165 When a peer, N, receives an Update request, it examines the Node-IDs 4166 in the UpdateReq and at its neighborhood table and decides if this 4167 UpdateReq would change its neighborhood table. This is done by 4168 taking the set of peers currently in the neighborhood table and 4169 comparing them to the peers in the update request. There are three 4170 major cases: 4172 o The UpdateReq contains peers that would not change the neighbor 4173 set because they match the neighborhood table. 4174 o The UpdateReq contains peers closer to N than those in its 4175 neighborhood table. 4176 o The UpdateReq defines peers that indicate a neighborhood table 4177 further away from N than some of its neighborhood table. Note 4178 that merely receiving peers further away does not demonstrate 4179 this, since the update could be from a node far away from N. 4180 Rather, the peers would need to bracket N. 4182 In the first case, no change is needed. 4184 In the second case, N MUST attempt to Attach to the new peers and if 4185 it is successful it MUST adjust its neighbor set accordingly. Note 4186 that it can maintain the now inferior peers as neighbors, but it MUST 4187 remember the closer ones. 4189 The third case implies that a neighbor has disappeared, most likely 4190 because it has simply been disconnected but perhaps because of 4191 overlay instability. N MUST Probe the questionable peers to discover 4192 if they are indeed missing and if so, remove them from its 4193 neighborhood table. 4195 After any Probes and Attaches are done, if the neighborhood table 4196 changes, the peer sends an Update request to each of its neighbors 4197 that was in either the old table or the new table. These Update 4198 requests are what ends up filling in the predecessor/successor tables 4199 of peers that this peer is a neighbor to. A peer MUST NOT enter 4200 itself in its successor or predecessor table and instead should leave 4201 the entries empty. 4203 If peer N which is responsible for a Resource-ID R discovers that the 4204 replica set for R (the next two nodes in its successor set) has 4205 changed, it MUST send a Store for any data associated with R to any 4206 new node in the replica set. It SHOULD NOT delete data from peers 4207 which have left the replica set. 4209 When a peer N detects that it is no longer in the replica set for a 4210 resource R (i.e., there are three predecessors between N and R), it 4211 SHOULD delete all data associated with R from its local store. 4213 10.7.3. Stabilization 4215 There are four components to stabilization: 4216 1. exchange Updates with all peers in its routing table to exchange 4217 state 4218 2. search for better peers to place in its finger table 4219 3. search to determine if the current finger table size is 4220 sufficiently large 4221 4. search to determine if the overlay has partitioned and needs to 4222 recover 4224 A peer MUST periodically send an Update request to every peer in its 4225 routing table. The purpose of this is to keep the predecessor and 4226 successor lists up to date and to detect connection failures. The 4227 default time is about every ten minutes, but the enrollment server 4228 SHOULD set this in the configuration document using the "chord-128-2- 4229 16+-update-frequency" element (denominated in seconds.) A peer 4230 SHOULD randomly offset these Update requests so they do not occur all 4231 at once. If an Update request fails or times out, the peer MUST mark 4232 that entry in the neighbor table invalid and attempt to reestablish a 4233 connection. If no connection can be established, the peer MUST 4234 attempt to establish a new peer as its neighbor and do whatever 4235 replica set adjustments are required. If a finger table entry is 4236 found to have failed, the peer MUST search for a replacement as 4237 directed below. 4239 A peer MUST periodically select a random entry i from the finger 4240 table and evaluate whether that entry should be replaced. The 4241 default time interval is about every hour, but the enrollment server 4242 SHOULD set this in the configuration document using the "chord-128-2- 4243 16+-probe-frequency" element (denominated in seconds). 4245 To evaluate whether the i'th finger table entry needs to be replaced, 4246 if the Node-ID of the entry is not valid for that finger table entry, 4247 the peer SHOULD search for a better entry. A peer searches for a 4248 better entry using a Probe request. If the Probe returns a different 4249 peer than the one currently in this entry of the finger table, then a 4250 new connection should be formed to replace the old entry in the 4251 finger table. 4253 A peer SHOULD consider the finger table entry valid if it is in the 4254 range [n+2^(numBitsInNodeId-i), n+2^(numBitsInNodeId-(i-1))- 4255 2^(numBitsInNodeId-(i+1))]. When searching for a better entry, the 4256 peer SHOULD send the Probe to a Node-ID selected randomly from that 4257 range. Random selection is preferred over a search for strictly 4258 spaced entries to minimize the effect of churn on overlay routing 4259 [minimizing-churn-sigcomm06]. An implementation or subsequent 4260 specification MAY choose a method for selecting finger table entries 4261 other than choosing randomly within the range. It is RECOMMENDED 4262 that any such alternate methods be employed only on finger table 4263 stabilization and not for the selection of initial finger table 4264 entries unless the alternative method is faster and imposes less 4265 overhead on the overlay. 4267 As an overlay grows, more than 16 entries may be required in the 4268 finger table for efficient routing. To determine if its finger table 4269 is sufficiently large, one an hour the peer should perform a Probe to 4270 determine whether growing its finger table by four entries would 4271 result in it learning at least two peers that it does not already 4272 have in its neighbor table. If so, then the finger table SHOULD be 4273 grown by four entries. Similarly, if the peer observes that its 4274 closest finger table entries are also in its neighbor table, it MAY 4275 shrink its finger table to the minimum size of 16 entries. [[OPEN 4276 ISSUE: there are a variety of algorithms to gauge the population of 4277 the overlay and select an appropriate finger table size. Need to 4278 consider which is the best combination of effectiveness and 4279 simplicity.]] 4281 To detect that a partitioning has occurred and to heal the overlay, a 4282 peer P MUST periodically repeat the discovery process used in the 4283 initial join for the overlay to locate an appropriate bootstrap peer, 4284 B. If an overlay has multiple mechanisms for discovery it should 4285 randomly select a method to locate a bootstrap peer. P should then 4286 send a Probe for its own Node-ID routed through B. If a response is 4287 received from a peer S', which is not P's successor, then the overlay 4288 is partitioned and P should send a Attach to S' routed through B, 4289 followed by an Update sent to S'. (Note that S' may not be in P's 4290 neighborhood table once the overlay is healed, but the connection 4291 will allow S' to discover appropriate neighbor entries for itself via 4292 its own stabilization.) 4294 10.8. Route Query 4296 For this topology plugin, the RouteQueryReq contains no additional 4297 information. The RouteQueryAns contains the single node ID of the 4298 next peer to which the responding peer would have routed the request 4299 message in recursive routing: 4301 struct { 4302 NodeId next_id; 4303 } ChordRouteQueryAns; 4305 The contents of this structure are as follows: 4307 next_peer 4308 The peer to which the responding peer would route the message to 4309 in order to deliver it to the destination listed in the request. 4311 If the requester set the send_update flag, the responder SHOULD 4312 initiate an Update immediately after sending the RouteQueryAns. 4314 10.9. Leaving 4316 Peers SHOULD send a Leave request prior to exiting the Overlay 4317 Instance. Any peer which receives a Leave for a peer n in its 4318 neighbor set must remove it from the neighbor set, update its replica 4319 sets as appropriate (including Stores of data to new members of the 4320 replica set) and send Updates containing its new predecessor and 4321 successor tables. 4323 11. Enrollment and Bootstrap 4325 11.1. Overlay Configuration 4327 This specification defines a new content type "application/ 4328 p2p-overlay+xml" for an MIME entity that contains overlay 4329 information. An example document is shown below. 4331 4332 4333 4334 [PEM encoded certificate here] 4335 4337 4338 4339 4340 4341 4342 4344 The file MUST be a well formed XML document and it SHOULD contain an 4345 encoding declaration in the XML declaration. If the charset 4346 parameter of the MIME content type declaration is present and it is 4347 different from the encoding declaration, the charset parameter takes 4348 precedence. Every application conforment to this specification MUST 4349 accept the UTF-8 character encoding to ensure minimal 4350 interoperability. The namespace for the elements defined in this 4351 specification is urn:ietf:params:xml:ns:p2p:overlay. 4353 The file can contain multiple "overlay" elements where each one 4354 contains the configuration information for a different overlay. Each 4355 "overlay" has the following attributes: 4357 instance-name: name of the overlay 4359 expiration: time in future at which this overlay configuration is 4360 not longer valid and need to be retrieved again. This is 4361 expressed in seconds from the current time. 4363 Inside each overlay element, the following elements can occur: 4365 topology-plugin This element has an attribute called algorithm-name 4366 that describes the overlay-algorithm being used. 4367 root-cert This element contains a PEM encoded X.509v3 certificate 4368 that is the root trust store used to sign all certificates in this 4369 overlay. There can be more than one of these. 4370 required-kinds This element indicates the kinds that members must 4371 support. It has three attributes: 4372 * name: a string representing the kind. 4373 * max-count: the maximum number of values which members of the 4374 overlay must support. 4375 * max-size: the maximum size of individual values. 4376 For instance, the example above indicates that members must 4377 support SIP-REGISTRATION with a maximum of 10 values of up to 1000 4378 bytes each. Multiple required-kinds elements MAY be present. 4379 credential-server This element contains the URL at which the 4380 credential server can be reached in a "url" element. This URL 4381 MUST be of type "https:". More than one credential-server element 4382 may be present. 4383 self-signed-permitted This element indicates whether self-signed 4384 certificates are permitted. If it is set to "TRUE", then self- 4385 signed certificates are allowed, in which case the credential- 4386 server and root-cert elements may be absent. Otherwise, it SHOULD 4387 be absent, but MAY be set "FALSE". This element also contains an 4388 attribute "digest" which indicates the digest to be used to 4389 compute the Node-ID. Valid values for this parameter are "SHA-1" 4390 and "SHA-256". 4392 bootstrap-peer This elements represents the address of one of the 4393 bootstrap peers. It has an attribute called "address" that 4394 represents the IP address (either IPv4 or IPv6, since they can be 4395 distinguished) and an attribute called "port" that represents the 4396 port. More than one bootstrap-peer element may be present. 4397 multicast-bootstrap This element represents the address of a 4398 multicast address and port that may be used for bootstrap and that 4399 peers SHOULD listen on to enable bootstrap. It has an attributed 4400 called "address" that represents the IP address and an attribute 4401 called "port" that represents the port. More than one "multicast- 4402 bootstrap" element may be present. 4403 clients-permitted This element represents whether clients are 4404 permitted or whether all nodes must be peers. If it is set to 4405 "TRUE" or absent, this indicates that clients are permitted. If 4406 it is set to "FALSE" then nodes MUST join as peers. 4407 attach-lite-permitted This element represents whether nodes are 4408 allowed to use the AttachLite request in this overlay. If it is 4409 absent, it is treated as if it was set to "FALSE". 4410 chord-128-2-16+-update-frequency The update frequency for the 4411 Chord-128-2-16+ topology plugin (see Section 10). 4412 chord-128-2-16+-probe-frequency The probe frequency for the Chord- 4413 128-2-16+ topology plugin (see Section 10). 4414 credential-server Base URL for credential server. 4415 shared-secret If shared secret mode is used, this contains the 4416 shared secret. 4418 [[TODO: Do a RelaxNG grammar.]] 4420 11.2. Discovery Through Enrollment Server 4422 When a peer first joins a new overlay, it starts with a discovery 4423 process to find an enrollment server. Related work to the approach 4424 used here is described in [I-D.garcia-p2psip-dns-sd-bootstrapping] 4425 and [I-D.matthews-p2psip-bootstrap-mechanisms]. Another scheme for 4426 referencing overlays is described in 4427 [I-D.hardie-p2poverlay-pointers]. The peer first determines the 4428 overlay name. This value is provided by the user or some other out 4429 of band provisioning mechanism. If the name is an IP address, that 4430 is directly used otherwise the peer MUST do a DNS SRV query using a 4431 Service name of "p2p_enroll" and a protocol of tcp to find an 4432 enrollment server. 4434 Once an address for the enrollment servers is determined, the peer 4435 forms an HTTPS connection to that IP address. The certificate MUST 4436 match the overlay name as described in [RFC2818]. 4438 Whenever a peer contacts the enrollment server, it MUST fetch a new 4439 copy of the configuration file. To do this, the peer performs a GET 4440 to the URL formed by appending a path of "/p2psip/enroll" to the 4441 overlay name. For example, if the overlay name was example.com, the 4442 URL would be "https://example.com/p2psip/enroll". The result is an 4443 XML configuration file described above, which replaces any previously 4444 learned configuration file for this overlay. 4446 [[OPEN ISSUE: for unsecured overlays or overlays not specified by 4447 domain name, need to specify another way to obtain/validate certs and 4448 to update configuration info]] 4450 11.3. Credentials 4452 If the configuration document contains a credential-server element, 4453 credentials are required to join the Overlay Instance. A peer which 4454 does not yet have credentials MUST contact the credential server to 4455 acquire them. 4457 In order to acquire credentials, the peer generates an asymmetric key 4458 pair and then generates a "Simple Enrollment Request" (as defined in 4459 [RFC5272]) and sends this over HTTPS as defined in [RFC5273] to the 4460 URL in the credential-server element. The subjectAltName in the 4461 request MUST contain the required user name. 4463 The credential server MUST authenticate the request using the 4464 provided user name and password. If the authentication succeeds and 4465 the requested user name is acceptable, the server and returns a 4466 certificate. The SubjectAltName field in the certificate contains 4467 the following values: 4469 o One or more Node-IDs which MUST be cryptographically random 4470 [RFC4086]. These MUST be chosen by the credential server in such 4471 a way that they are unpredictable to the requesting user. These 4472 are of type URI and MUST contain RELOAD URIs as described in 4473 Section 14.10 and MUST contain a Destination list with a single 4474 entry of type "node_id". 4475 o The names this user is allowed to use in the overlay, using type 4476 rfc822Name. 4478 The certificate is returned in a "Simple Enrollment Response". 4479 [[TODO: REF]] 4481 The client MUST check that the certificate returned was signed by one 4482 of the certificates received in the "root-cert" list of the overlay 4483 configuration data. The peer then reads the certificate to find the 4484 Node-IDs it can use. 4486 11.3.1. Self-Generated Credentials 4488 If the "self-signed-permitted" element is present and set to "TRUE", 4489 then a node MUST generate its own self-signed certificate to join the 4490 overlay. The self-signed certificate MAY contain any user name of 4491 the users choice. Users SHOULD make some attempt to make it unique 4492 but this document does not specify any mechanisms for that. 4494 The Node-ID MUST be computed by applying the digest specified in the 4495 self-signed-permitted element to the DER representation of the user's 4496 public key. When accepting a self-signed certificate, nodes MUST 4497 check that the Node-ID and public keys match. This prevents Node-ID 4498 theft. 4500 Once the node has constructed a self-signed certificate, it MAY join 4501 the overlay. Before storing its certificate in the overlay 4502 (Section 7) it SHOULD look to see if the user name is already taken 4503 and if so choose another user name. Note that this only provides 4504 protection against accidental name collisions. Name theft is still 4505 possible. If protection against name theft is desired, then the 4506 enrollment service must be used. 4508 11.4. Joining the Overlay Peer 4510 In order to join the overlay, the peer MUST contact a peer. 4511 Typically this means contacting the bootstrap peers, since they are 4512 guaranteed to have public IP addresses (the system should not 4513 advertise them as bootstrap peers otherwise). If the peer has cached 4514 peers it SHOULD contact them first by sending a Probe request to the 4515 known peer address with the destination Node-ID set to that peer's 4516 Node-ID. 4518 If no cached peers are available, then the peer SHOULD send a Probe 4519 request to the address and port found in the broadcast-peers element 4520 in the configuration document. This MAY be a multicast or anycast 4521 address. The Probe should use the wildcard Node-ID as the 4522 destination Node-ID. 4524 The responder peer that receives the Probe request SHOULD check that 4525 the overlay name is correct and that the requester peer sending the 4526 request has appropriate credentials for the overlay before responding 4527 to the Probe request even if the response is only an error. 4529 When the requester peer finally does receive a response from some 4530 responding peer, it can note the Node-ID in the response and use this 4531 Node-ID to start sending requests to join the Overlay Instance as 4532 described in Section 5.3. 4534 After a peer has successfully joined the overlay network, it SHOULD 4535 periodically look at any peers to which it has managed to form direct 4536 connections. Some of these peers MAY be added to the cached-peers 4537 list and used in future boots. Peers that are not directly connected 4538 MUST NOT be cached. The RECOMMENDED number of peers to cache is 10. 4540 12. Message Flow Example 4542 In the following example, we assume that JP has formed a connection 4543 to one of the bootstrap peers. JP then sends an Attach through that 4544 peer to the admitting peer (AP) to initiate a connection. When AP 4545 responds, JP and AP use ICE to set up a connection and then set up 4546 TLS. 4548 JP PPP PP AP NP NNP BP 4549 | | | | | | | 4550 | | | | | | | 4551 | | | | | | | 4552 |Attach Dest=JP | | | | | 4553 |---------------------------------------------------------->| 4554 | | | | | | | 4555 | | | | | | | 4556 | | |Attach Dest=JP | | | 4557 | | |<--------------------------------------| 4558 | | | | | | | 4559 | | | | | | | 4560 | | |Attach Dest=JP | | | 4561 | | |-------->| | | | 4562 | | | | | | | 4563 | | | | | | | 4564 | | |AttachAns | | | 4565 | | |<--------| | | | 4566 | | | | | | | 4567 | | | | | | | 4568 | | |AttachAns | | | 4569 | | |-------------------------------------->| 4570 | | | | | | | 4571 | | | | | | | 4572 |AttachAns | | | | | 4573 |<----------------------------------------------------------| 4574 | | | | | | | 4575 | | | | | | | 4576 |TLS | | | | | | 4577 |.............................| | | | 4578 | | | | | | | 4579 | | | | | | | 4580 | | | | | | | 4581 | | | | | | | 4583 Once JP has connected to AP, it needs to populate its Routing Table. 4584 In Chord, this means that it needs to populate its neighbor table and 4585 its finger table. To populate its neighbor table, it needs the 4586 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 4587 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 4588 to set up a connection. 4590 JP PPP PP AP NP NNP BP 4591 | | | | | | | 4592 | | | | | | | 4593 | | | | | | | 4594 |Attach AP+1 | | | | | 4595 |---------------------------->| | | | 4596 | | | | | | | 4597 | | | | | | | 4598 | | | |Attach AP+1 | | 4599 | | | |-------->| | | 4600 | | | | | | | 4601 | | | | | | | 4602 | | | |AttachAns | | 4603 | | | |<--------| | | 4604 | | | | | | | 4605 | | | | | | | 4606 |AttachAns | | | | | 4607 |<----------------------------| | | | 4608 | | | | | | | 4609 | | | | | | | 4610 |Attach | | | | | | 4611 |-------------------------------------->| | | 4612 | | | | | | | 4613 | | | | | | | 4614 |TLS | | | | | | 4615 |.......................................| | | 4616 | | | | | | | 4617 | | | | | | | 4618 | | | | | | | 4619 | | | | | | | 4621 JP also needs to populate its finger table (for Chord). It issues a 4622 Attach to a variety of locations around the overlay. The diagram 4623 below shows it sending an Attach halfway around the Chord ring the JP 4624 + 2^127. 4626 JP NP XX TP 4627 | | | | 4628 | | | | 4629 | | | | 4630 |Attach JP+2<<126 | | 4631 |-------->| | | 4632 | | | | 4633 | | | | 4634 | |Attach JP+2<<126 | 4635 | |-------->| | 4636 | | | | 4637 | | | | 4638 | | |Attach JP+2<<126 4639 | | |-------->| 4640 | | | | 4641 | | | | 4642 | | |AttachAns| 4643 | | |<--------| 4644 | | | | 4645 | | | | 4646 | |AttachAns| | 4647 | |<--------| | 4648 | | | | 4649 | | | | 4650 |AttachAns| | | 4651 |<--------| | | 4652 | | | | 4653 | | | | 4654 |TLS | | | 4655 |.............................| 4656 | | | | 4657 | | | | 4658 | | | | 4659 | | | | 4661 Once JP has a reasonable set of connections he is ready to take his 4662 place in the DHT. He does this by sending a Join to AP. AP does a 4663 series of Store requests to JP to store the data that JP will be 4664 responsible for. AP then sends JP an Update explicitly labeling JP 4665 as its predecessor. At this point, JP is part of the ring and 4666 responsible for a section of the overlay. AP can now forget any data 4667 which is assigned to JP and not AP. 4669 JP PPP PP AP NP NNP BP 4670 | | | | | | | 4671 | | | | | | | 4672 | | | | | | | 4673 |JoinReq | | | | | | 4674 |---------------------------->| | | | 4675 | | | | | | | 4676 | | | | | | | 4677 |JoinAns | | | | | | 4678 |<----------------------------| | | | 4679 | | | | | | | 4680 | | | | | | | 4681 |StoreReq Data A | | | | | 4682 |<----------------------------| | | | 4683 | | | | | | | 4684 | | | | | | | 4685 |StoreAns | | | | | | 4686 |---------------------------->| | | | 4687 | | | | | | | 4688 | | | | | | | 4689 |StoreReq Data B | | | | | 4690 |<----------------------------| | | | 4691 | | | | | | | 4692 | | | | | | | 4693 |StoreAns | | | | | | 4694 |---------------------------->| | | | 4695 | | | | | | | 4696 | | | | | | | 4697 |UpdateReq| | | | | | 4698 |<----------------------------| | | | 4699 | | | | | | | 4700 | | | | | | | 4701 |UpdateAns| | | | | | 4702 |---------------------------->| | | | 4703 | | | | | | | 4704 | | | | | | | 4705 | | | | | | | 4706 | | | | | | | 4708 In Chord, JP's neighbor table needs to contain its own predecessors. 4709 It couldn't connect to them previously because Chord has no way to 4710 route immediately to your predecessors. However, now that it has 4711 received an Update from AP, it has APs predecessors, which are also 4712 its own, so it sends Attaches to them. Below it is shown connecting 4713 to its closest predecessor, PP. 4715 JP PPP PP AP NP NNP BP 4716 | | | | | | | 4717 | | | | | | | 4718 | | | | | | | 4719 |Attach Dest=PP | | | | | 4720 |---------------------------->| | | | 4721 | | | | | | | 4722 | | | | | | | 4723 | | |Attach Dest=PP | | | 4724 | | |<--------| | | | 4725 | | | | | | | 4726 | | | | | | | 4727 | | |AttachAns| | | | 4728 | | |-------->| | | | 4729 | | | | | | | 4730 | | | | | | | 4731 |AttachAns| | | | | | 4732 |<----------------------------| | | | 4733 | | | | | | | 4734 | | | | | | | 4735 |TLS | | | | | | 4736 |...................| | | | | 4737 | | | | | | | 4738 | | | | | | | 4739 |UpdateReq| | | | | | 4740 |------------------>| | | | | 4741 | | | | | | | 4742 | | | | | | | 4743 |UpdateAns| | | | | | 4744 |<------------------| | | | | 4745 | | | | | | | 4746 | | | | | | | 4747 |UpdateReq| | | | | | 4748 |---------------------------->| | | | 4749 | | | | | | | 4750 | | | | | | | 4751 |UpdateAns| | | | | | 4752 |<----------------------------| | | | 4753 | | | | | | | 4754 | | | | | | | 4755 |UpdateReq| | | | | | 4756 |-------------------------------------->| | | 4757 | | | | | | | 4758 | | | | | | | 4759 |UpdateAns| | | | | | 4760 |<--------------------------------------| | | 4761 | | | | | | | 4762 | | | | | | | 4764 Finally, now that JP has a copy of all the data and is ready to route 4765 messages and receive requests, it sends Updates to everyone in its 4766 Routing Table to tell them it is ready to go. Below, it is shown 4767 sending such an update to TP. 4769 JP NP XX TP 4770 | | | | 4771 | | | | 4772 | | | | 4773 |Update | | | 4774 |---------------------------->| 4775 | | | | 4776 | | | | 4777 |UpdateAns| | | 4778 |<----------------------------| 4779 | | | | 4780 | | | | 4781 | | | | 4782 | | | | 4784 13. Security Considerations 4786 13.1. Overview 4788 RELOAD provides a generic storage service, albeit one designed to be 4789 useful for P2PSIP. In this section we discuss security issues that 4790 are likely to be relevant to any usage of RELOAD. 4792 In any Overlay Instance, any given user depends on a number of peers 4793 with which they have no well-defined relationship except that they 4794 are fellow members of the Overlay Instance. In practice, these other 4795 nodes may be friendly, lazy, curious, or outright malicious. No 4796 security system can provide complete protection in an environment 4797 where most nodes are malicious. The goal of security in RELOAD is to 4798 provide strong security guarantees of some properties even in the 4799 face of a large number of malicious nodes and to allow the overlay to 4800 function correctly in the face of a modest number of malicious nodes. 4802 P2PSIP deployments require the ability to authenticate both peers and 4803 resources (users) without the active presence of a trusted entity in 4804 the system. We describe two mechanisms. The first mechanism is 4805 based on public key certificates and is suitable for general 4806 deployments. The second is an admission control mechanism based on 4807 an overlay-wide shared symmetric key. 4809 13.2. Attacks on P2P Overlays 4811 The two basic functions provided by overlay nodes are storage and 4812 routing: some node is responsible for storing a peer's data and for 4813 allowing a peer to fetch other peer's data. Some other set of nodes 4814 are responsible for routing messages to and from the storing nodes. 4815 Each of these issues is covered in the following sections. 4817 P2P overlays are subject to attacks by subversive nodes that may 4818 attempt to disrupt routing, corrupt or remove user registrations, or 4819 eavesdrop on signaling. The certificate-based security algorithms we 4820 describe in this draft are intended to protect overlay routing and 4821 user registration information in RELOAD messages. 4823 To protect the signaling from attackers pretending to be valid peers 4824 (or peers other than themselves), the first requirement is to ensure 4825 that all messages are received from authorized members of the 4826 overlay. For this reason, RELOAD transports all messages over a 4827 secure channel (TLS and DTLS are defined in this document) which 4828 provides message integrity and authentication of the directly 4829 communicating peer. In addition, messages and data are digitally 4830 signed with the sender's private key, providing end-to-end security 4831 for communications. 4833 13.3. Certificate-based Security 4835 This specification stores users' registrations and possibly other 4836 data in an overlay network. This requires a solution to securing 4837 this data as well as securing, as well as possible, the routing in 4838 the overlay. Both types of security are based on requiring that 4839 every entity in the system (whether user or peer) authenticate 4840 cryptographically using an asymmetric key pair tied to a certificate. 4842 When a user enrolls in the Overlay Instance, they request or are 4843 assigned a unique name, such as "alice@dht.example.net". These names 4844 are unique and are meant to be chosen and used by humans much like a 4845 SIP Address of Record (AOR) or an email address. The user is also 4846 assigned one or more Node-IDs by the central enrollment authority. 4847 Both the name and the peer ID are placed in the certificate, along 4848 with the user's public key. 4850 Each certificate enables an entity to act in two sorts of roles: 4852 o As a user, storing data at specific Resource-IDs in the Overlay 4853 Instance corresponding to the user name. 4854 o As a overlay peer with the peer ID(s) listed in the certificate. 4856 Note that since only users of this Overlay Instance need to validate 4857 a certificate, this usage does not require a global PKI. Instead, 4858 certificates are signed by require a central enrollment authority 4859 which acts as the certificate authority for the Overlay Instance. 4860 This authority signs each peer's certificate. Because each peer 4861 possesses the CA's certificate (which they receive on enrollment) 4862 they can verify the certificates of the other entities in the overlay 4863 without further communication. Because the certificates contain the 4864 user/peer's public key, communications from the user/peer can be 4865 verified in turn. 4867 If self-signed certificates are used, then the security provided is 4868 significantly decreased, since attackers can mount Sybil attacks. In 4869 addition, attackers cannot trust the user names in certificates 4870 (though they can trust the Node-IDs because they are 4871 cryptographically verifiable). This scheme is only appropriate for 4872 small deployments, such as a small office or ad hoc overlay set up 4873 among participants in a meeting. Some additional security can be 4874 provided by using the shared secret admission control scheme as well. 4876 Because all stored data is signed by the owner of the data the 4877 storing peer can verify that the storer is authorized to perform a 4878 store at that Resource-ID and also allows any consumer of the data to 4879 verify the provenance and integrity of the data when it retrieves it. 4881 All implementations MUST implement certificate-based security. 4883 13.4. Shared-Secret Security 4885 RELOAD also supports a shared secret admission control scheme that 4886 relies on a single key that is shared among all members of the 4887 overlay. It is appropriate for small groups that wish to form a 4888 private network without complexity. In shared secret mode, all the 4889 peers share a single symmetric key which is used to key TLS-PSK 4890 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 4891 key cannot form TLS connections with any other peer and therefore 4892 cannot join the overlay. 4894 One natural approach to a shared-secret scheme is to use a user- 4895 entered password as the key. The difficulty with this is that in 4896 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 4897 If passwords are used as the source of shared-keys, then TLS-SRP is a 4898 superior choice because it is not subject to dictionary attacks. 4900 13.5. Storage Security 4902 When certificate-based security is used in RELOAD, any given 4903 Resource-ID/Kind-ID pair (a slot) is bound to some small set of 4904 certificates. In order to write data in a slot, the writer must 4905 prove possession of the private key for one of those certificates. 4906 Moreover, all data is stored signed by the certificate which 4907 authorized its storage. This set of rules makes questions of 4908 authorization and data integrity - which have historically been 4909 thorny for overlays - relatively simple. 4911 13.5.1. Authorization 4913 When a client wants to store some value in a slot, it first digitally 4914 signs the value with its own private key. It then sends a Store 4915 request that contains both the value and the signature towards the 4916 storing peer (which is defined by the Resource Name construction 4917 algorithm for that particular kind of value). 4919 When the storing peer receives the request, it must determine whether 4920 the storing client is authorized to store in this slot. In order to 4921 do so, it executes the Resource Name construction algorithm for the 4922 specified kind based on the user's certificate information. It then 4923 computes the Resource-ID from the Resource Name and verifies that it 4924 matches the slot which the user is requesting to write to. If it 4925 does, the user is authorized to write to this slot, pending quota 4926 checks as described in the next section. 4928 For example, consider the certificate with the following properties: 4930 User name: alice@dht.example.com 4931 Node-ID: 013456789abcdef 4932 Serial: 1234 4934 If Alice wishes to Store a value of the "SIP Location" kind, the 4935 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 4936 Resource-ID will be determined by hashing the Resource Name. When a 4937 peer receives a request to store a record at Resource-ID X, it takes 4938 the signing certificate and recomputes the Resource Name, in this 4939 case "alice@dht.example.com". If H("alice@dht.example.com")=X then 4940 the Store is authorized. Otherwise it is not. Note that the 4941 Resource Name construction algorithm may be different for other 4942 kinds. 4944 13.5.2. Distributed Quota 4946 Being a peer in a Overlay Instance carries with it the responsibility 4947 to store data for a given region of the Overlay Instance. However, 4948 if clients were allowed to store unlimited amounts of data, this 4949 would create unacceptable burdens on peers, as well as enabling 4950 trivial denial of service attacks. RELOAD addresses this issue by 4951 requiring configurations to define maximum sizes for each kind of 4952 stored data. Attempts to store values exceeding this size MUST be 4953 rejected (if peers are inconsistent about this, then strange 4954 artifacts will happen when the zone of responsibility shifts and a 4955 different peer becomes responsible for overlarge data). Because each 4956 slot is bound to a small set of certificates, these size restrictions 4957 also create a distributed quota mechanism, with the quotas 4958 administered by the central enrollment server. 4960 Allowing different kinds of data to have different size restrictions 4961 allows new usages the flexibility to define limits that fit their 4962 needs without requiring all usages to have expansive limits. 4964 13.5.3. Correctness 4966 Because each stored value is signed, it is trivial for any retrieving 4967 peer to verify the integrity of the stored value. Some more care 4968 needs to be taken to prevent version rollback attacks. Rollback 4969 attacks on storage are prevented by the use of store times and 4970 lifetime values in each store. A lifetime represents the latest time 4971 at which the data is valid and thus limits (though does not 4972 completely prevent) the ability of the storing node to perform a 4973 rollback attack on retrievers. In order to prevent a rollback attack 4974 at the time of the Store request, we require that storage times be 4975 monotonically increasing. Storing peers MUST reject Store requests 4976 with storage times smaller than or equal to those they are currently 4977 storing. In addition, a fetching node which receives a data value 4978 with a storage time older than the result of the previous fetch knows 4979 a rollback has occurred. 4981 13.5.4. Residual Attacks 4983 The mechanisms described here provide a high degree of security, but 4984 some attacks remain possible. Most simply, it is possible for 4985 storing nodes to refuse to store a value (i.e., reject any request). 4986 In addition, a storing node can deny knowledge of values which it 4987 previously accepted. To some extent these attacks can be ameliorated 4988 by attempting to store to/retrieve from replicas, but a retrieving 4989 client does not know whether it should try this or not, since there 4990 is a cost to doing so. 4992 Although the certificate-based authentication scheme prevents a 4993 single peer from being able to forge data owned by other peers. 4994 Furthermore, although a subversive peer can refuse to return data 4995 resources for which it is responsible it cannot return forged data 4996 because it cannot provide authentication for such registrations. 4997 Therefore parallel searches for redundant registrations can mitigate 4998 most of the affects of a compromised peer. The ultimate reliability 4999 of such an overlay is a statistical question based on the replication 5000 factor and the percentage of compromised peers. 5002 In addition, when a kind is multivalued (e.g., an array data model), 5003 the storing node can return only some subset of the values, thus 5004 biasing its responses. This can be countered by using single values 5005 rather than sets, but that makes coordination between multiple 5006 storing agents much more difficult. This is a tradeoff that must be 5007 made when designing any usage. 5009 13.6. Routing Security 5011 Because the storage security system guarantees (within limits) the 5012 integrity of the stored data, routing security focuses on stopping 5013 the attacker from performing a DOS attack on the system by misrouting 5014 requests in the overlay. There are a few obvious observations to 5015 make about this. First, it is easy to ensure that an attacker is at 5016 least a valid peer in the Overlay Instance. Second, this is a DOS 5017 attack only. Third, if a large percentage of the peers on the 5018 Overlay Instance are controlled by the attacker, it is probably 5019 impossible to perfectly secure against this. 5021 13.6.1. Background 5023 In general, attacks on DHT routing are mounted by the attacker 5024 arranging to route traffic through or two nodes it controls. In the 5025 Eclipse attack [Eclipse] the attacker tampers with messages to and 5026 from nodes for which it is on-path with respect to a given victim 5027 node. This allows it to pretend to be all the nodes that are 5028 reachable through it. In the Sybil attack [Sybil], the attacker 5029 registers a large number of nodes and is therefore able to capture a 5030 large amount of the traffic through the DHT. 5032 Both the Eclipse and Sybil attacks require the attacker to be able to 5033 exercise control over her peer IDs. The Sybil attack requires the 5034 creation of a large number of peers. The Eclipse attack requires 5035 that the attacker be able to impersonate specific peers. In both 5036 cases, these attacks are limited by the use of centralized, 5037 certificate-based admission control. 5039 13.6.2. Admissions Control 5041 Admission to an RELOAD Overlay Instance is controlled by requiring 5042 that each peer have a certificate containing its peer ID. The 5043 requirement to have a certificate is enforced by using certificate- 5044 based mutual authentication on each connection. Thus, whenever a 5045 peer connects to another peer, each side automatically checks that 5046 the other has a suitable certificate. These peer IDs are randomly 5047 assigned by the central enrollment server. This has two benefits: 5049 o It allows the enrollment server to limit the number of peer IDs 5050 issued to any individual user. 5051 o It prevents the attacker from choosing specific peer IDs. 5053 The first property allows protection against Sybil attacks (provided 5054 the enrollment server uses strict rate limiting policies). The 5055 second property deters but does not completely prevent Eclipse 5056 attacks. Because an Eclipse attacker must impersonate peers on the 5057 other side of the attacker, he must have a certificate for suitable 5058 peer IDs, which requires him to repeatedly query the enrollment 5059 server for new certificates which only will match by chance. From 5060 the attacker's perspective, the difficulty is that if he only has a 5061 small number of certificates the region of the Overlay Instance he is 5062 impersonating appears to be very sparsely populated by comparison to 5063 the victim's local region. 5065 13.6.3. Peer Identification and Authentication 5067 In general, whenever a peer engages in overlay activity that might 5068 affect the routing table it must establish its identity. This 5069 happens in two ways. First, whenever a peer establishes a direct 5070 connection to another peer it authenticates via certificate-based 5071 mutual authentication. All messages between peers are sent over this 5072 protected channel and therefore the peers can verify the data origin 5073 of the last hop peer for requests and responses without further 5074 cryptography. 5076 In some situations, however, it is desirable to be able to establish 5077 the identity of a peer with whom one is not directly connected. The 5078 most natural case is when a peer Updates its state. At this point, 5079 other peers may need to update their view of the overlay structure, 5080 but they need to verify that the Update message came from the actual 5081 peer rather than from an attacker. To prevent this, all overlay 5082 routing messages are signed by the peer that generated them. 5084 [OPEN ISSUE: this allows for replay attacks on requests. There are 5085 two basic defenses here. The first is global clocks and loose anti- 5086 replay. The second is to refuse to take any action unless you verify 5087 the data with the relevant node. This issue is undecided.] 5089 [TODO: I think we are probably going to end up with generic 5090 signatures or at least optional signatures on all overlay messages.] 5092 13.6.4. Protecting the Signaling 5094 The goal here is to stop an attacker from knowing who is signaling 5095 what to whom. An attacker being able to observe the activities of a 5096 specific individual is unlikely given the randomization of IDs and 5097 routing based on the present peers discussed above. Furthermore, 5098 because messages can be routed using only the header information, the 5099 actual body of the RELOAD message can be encrypted during 5100 transmission. 5102 There are two lines of defense here. The first is the use of TLS or 5103 DTLS for each communications link between peers. This provides 5104 protection against attackers who are not members of the overlay. The 5105 second line of defense, if certificate-based security is used, is to 5106 digitally sign each message. This prevents adversarial peers from 5107 modifying messages in flight, even if they are on the routing path. 5109 13.6.5. Residual Attacks 5111 The routing security mechanisms in RELOAD are designed to contain 5112 rather than eliminate attacks on routing. It is still possible for 5113 an attacker to mount a variety of attacks. In particular, if an 5114 attacker is able to take up a position on the overlay routing between 5115 A and B it can make it appear as if B does not exist or is 5116 disconnected. It can also advertise false network metrics in attempt 5117 to reroute traffic. However, these are primarily DoS attacks. 5119 The certificate-based security scheme secures the namespace, but if 5120 an individual peer is compromised or if an attacker obtains a 5121 certificate from the CA, then a number of subversive peers can still 5122 appear in the overlay. While these peers cannot falsify responses to 5123 resource queries, they can respond with error messages, effecting a 5124 DoS attack on the resource registration. They can also subvert 5125 routing to other compromised peers. To defend against such attacks, 5126 a resource search must still consist of parallel searches for 5127 replicated registrations. 5129 14. IANA Considerations 5131 This section contains the new code points registered by this 5132 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 5133 the RFC number for this specification in the following list.] 5135 [[TODO - add IANA registration for p2p_enroll SRV and p2p_menroll]] 5137 14.1. Overlay Algorithm Types 5139 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 5140 Entries in this registry are strings denoting the names of overlay 5141 algorithms. The registration policy for this registry is RFC 5226 5142 IETF Review. The initial contents of this registry are: 5144 +-----------------+----------+ 5145 | Algorithm Name | RFC | 5146 +-----------------+----------+ 5147 | chord-128-2-16+ | RFC-AAAA | 5148 +-----------------+----------+ 5150 14.2. Data Kind-ID 5152 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 5153 registry are 32-bit integers denoting data kinds, as described in 5154 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 5155 SHALL be registered via RFC 5226 Standards Action. Code points in 5156 the range 0x8000000 to 0xfffffffe SHALL be registered via RFC 5226 5157 Expert Review. The initial contents of this registry are: 5159 +--------------------+------------+----------+ 5160 | Kind | Kind-ID | RFC | 5161 +--------------------+------------+----------+ 5162 | INVALID | 0 | RFC-AAAA | 5163 | SIP-REGISTRATION | 1 | RFC-AAAA | 5164 | TURN_SERVICE | 2 | RFC-AAAA | 5165 | CERTIFICATE | 3 | RFC-AAAA | 5166 | ROUTING_TABLE_SIZE | 4 | RFC-AAAA | 5167 | SOFTWARE_VERSION | 5 | RFC-AAAA | 5168 | MACHINE_UPTIME | 6 | RFC-AAAA | 5169 | APP_UPTIME | 7 | RFC-AAAA | 5170 | MEMORY_FOOTPRINT | 8 | RFC-AAAA | 5171 | DATASIZE_StoreD | 9 | RFC-AAAA | 5172 | INSTANCES_StoreD | 10 | RFC-AAAA | 5173 | MESSAGES_SENT_RCVD | 11 | RFC-AAAA | 5174 | EWMA_BYTES_SENT | 12 | RFC-AAAA | 5175 | EWMA_BYTES_RCVD | 13 | RFC-AAAA | 5176 | LAST_CONTACT | 14 | RFC-AAAA | 5177 | RTT | 15 | RFC-AAAA | 5178 | Reserved | 0x7fffffff | RFC-AAAA | 5179 | Reserved | 0xffffffff | RFC-AAAA | 5180 +--------------------+------------+----------+ 5182 14.3. Data Model 5184 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 5185 registry are 8-bit integers denoting data models, as described in 5186 Section 6.2. Code points in this registry SHALL be registered via 5187 RFC 5226 IETF Review. The initial contents of this registry are: 5189 +--------------+------+----------+ 5190 | Data Model | Code | RFC | 5191 +--------------+------+----------+ 5192 | INVALID | 0 | RFC-AAAA | 5193 | SINGLE_VALUE | 1 | RFC-AAAA | 5194 | ARRAY | 2 | RFC-AAAA | 5195 | DICTIONARY | 3 | RFC-AAAA | 5196 | RESERVED | 255 | RFC-AAAA | 5197 +--------------+------+----------+ 5199 14.4. Message Codes 5201 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 5202 registry are 16-bit integers denoting method codes as described in 5203 Section 5.2.3. These codes SHALL be registered via RFC 5226 5204 Standards Action. The initial contents of this registry are: 5206 +-------------------+----------------+----------+ 5207 | Message Code Name | Code Value | RFC | 5208 +-------------------+----------------+----------+ 5209 | invalid | 0 | RFC-AAAA | 5210 | probe_req | 1 | RFC-AAAA | 5211 | probe_ans | 2 | RFC-AAAA | 5212 | attach_req | 3 | RFC-AAAA | 5213 | attach_ans | 4 | RFC-AAAA | 5214 | unused | 5 | | 5215 | unused | 6 | | 5216 | store_req | 7 | RFC-AAAA | 5217 | store_ans | 8 | RFC-AAAA | 5218 | fetch_req | 9 | RFC-AAAA | 5219 | fetch_ans | 10 | RFC-AAAA | 5220 | remove_req | 11 | RFC-AAAA | 5221 | remove_ans | 12 | RFC-AAAA | 5222 | find_req | 13 | RFC-AAAA | 5223 | find_ans | 14 | RFC-AAAA | 5224 | join_req | 15 | RFC-AAAA | 5225 | join_ans | 16 | RFC-AAAA | 5226 | leave_req | 17 | RFC-AAAA | 5227 | leave_ans | 18 | RFC-AAAA | 5228 | update_req | 19 | RFC-AAAA | 5229 | update_ans | 20 | RFC-AAAA | 5230 | route_query_req | 21 | RFC-AAAA | 5231 | route_query_ans | 22 | RFC-AAAA | 5232 | ping_req | 23 | RFC-AAAA | 5233 | ping_ans | 24 | RFC-AAAA | 5234 | stat_req | 25 | RFC-AAAA | 5235 | stat_ans | 26 | RFC-AAAA | 5236 | attachlite_req | 27 | RFC-AAAA | 5237 | attachlite_ans | 28 | RFC-AAAA | 5238 | reserved | 0x8000..0xfffe | RFC-AAAA | 5239 | error | 0xffff | RFC-AAAA | 5240 +-------------------+----------------+----------+ 5242 14.5. Error Codes 5244 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 5245 registry are 16-bit integers denoting error codes. New entries SHALL 5246 be defined via RFC 5226 Standards Action. The initial contents of 5247 this registry are: 5249 +-------------------------------------+----------------+----------+ 5250 | Error Code Name | Code Value | RFC | 5251 +-------------------------------------+----------------+----------+ 5252 | invalid | 0 | RFC-AAAA | 5253 | Error_Unauthorized | 1 | RFC-AAAA | 5254 | Error_Forbidden | 2 | RFC-AAAA | 5255 | Error_Not_Found | 3 | RFC-AAAA | 5256 | Error_Request_Timeout | 4 | RFC-AAAA | 5257 | Error_Precondition_Failed | 5 | RFC-AAAA | 5258 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 5259 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 5260 | Error_Data_Too_Large | 8 | RFC-AAAA | 5261 | Error_Data_Too_Old | 9 | RFC-AAAA | 5262 | reserved | 0x8000..0xfffe | RFC-AAAA | 5263 +-------------------------------------+----------------+----------+ 5265 14.6. Route Log Extension Types 5267 IANA SHALL create a "RELOAD Route Log Extension Type Registry." New 5268 entries SHALL be defined via RFC 5226 Specification Required. The 5269 initial contents of this registry are: 5271 +--------------------------+------+---------------+ 5272 | Route Log Extension Name | Code | Specification | 5273 +--------------------------+------+---------------+ 5274 | invalid | 0 | RFC-AAAA | 5275 | reserved | 255 | RFC-AAAA | 5276 +--------------------------+------+---------------+ 5278 14.7. Overlay Link Types 5280 IANA shall create a "RELOAD Overlay Link Type Registry." New entries 5281 SHALL be defined via RFC 5226 Standards Action. This registry SHALL 5282 be initially populated with the following values: 5284 +----------+------+---------------+ 5285 | Protocol | Code | Specification | 5286 +----------+------+---------------+ 5287 | invalid | 0 | RFC-AAAA | 5288 | tcp_tls | 1 | RFC-AAAA | 5289 | udp_dtls | 2 | RFC-AAAA | 5290 | reserved | 255 | RFC-AAAA | 5291 +----------+------+---------------+ 5293 14.8. Forwarding Options 5295 IANA shall create a "Forwarding Option Registry". Entries in this 5296 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 5297 Action. Entries in this registry between 128 and 254 SHALL be 5298 defined via RFC 5226 Specification Required. This registry SHALL be 5299 initially populated with the following values: 5301 +-------------------+------+---------------+ 5302 | Forwarding Option | Code | Specification | 5303 +-------------------+------+---------------+ 5304 | invalid | 0 | RFC-AAAA | 5305 | reserved | 255 | RFC-AAAA | 5306 +-------------------+------+---------------+ 5308 14.9. Probe Information Types 5310 IANA shall create a "RELOAD Probe Information Type Registry". 5311 Entries in this registry SHALL be defined via RFC 5226 Standards 5312 Action. This registry SHALL be initially populated with the 5313 following values: 5315 +-----------------+------+---------------+ 5316 | Probe Option | Code | Specification | 5317 +-----------------+------+---------------+ 5318 | invalid | 0 | RFC-AAAA | 5319 | responsible_set | 1 | RFC-AAAA | 5320 | requested_info | 2 | RFC-AAAA | 5321 | reserved | 255 | RFC-AAAA | 5322 +-----------------+------+---------------+ 5324 14.10. reload: URI Scheme 5326 This section describes the scheme for a reload: URI, which can be 5327 used to refer to either: 5329 o A peer. 5330 o A resource inside a peer. 5332 The reload: URI is defined using a subset of the URI schema 5333 specified in Appendix A. of RFC 3986 [REF] and the associated URI 5334 Guidelines [REF: RFC4395] per the following ABNF syntax: 5336 RELOAD-URI = "reload://" destination "@" overlay "/" 5337 [specifier] 5339 destination = 1 * HEXDIG 5340 overlay = reg-name 5341 specifier = 1*HEXDIG 5343 The definitions of these productions are as follows: 5345 destination: a hex-encoded Destination List object. 5347 overlay: the name of the overlay. 5349 specifier : a hex-encoded StoredDataSpecifier indicating the data 5350 element. 5352 If no specifier is present than this URI addresses the peer which can 5353 be reached via the indicated destination list at the indicated 5354 overlay name. If a specifier is present, then the URI addresses the 5355 data value. 5357 14.10.1. URI Registration 5359 The following summarizes the information necessary to register the 5360 reload: URI. 5362 URI Scheme Name: reload 5363 Status: permanent 5364 URI Scheme Syntax: see Section 14.10. 5365 URI Scheme Semantics: The reload: URI is intended to be used as a 5366 reference to a RELOAD peer or resource. 5367 Encoding Considerations: The reload: URI is not intended to be 5368 human-readable text, therefore they are encoded entirely in US- 5369 ASCII. 5370 Applications/protocols that use this URI scheme: The RELOAD 5371 protocol described in RFC-AAAA. 5372 TBD for the rest of this template. 5374 15. Acknowledgments 5376 This draft is a merge of the "REsource LOcation And Discovery 5377 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 5378 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 5379 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 5380 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 5381 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 5382 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 5383 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 5384 Matuszewski. 5386 Thanks to the many people who contributed including: Michael Chen, 5387 TODO - fill in. 5389 16. References 5391 16.1. Normative References 5393 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 5394 Requirement Levels", BCP 14, RFC 2119, March 1997. 5396 [I-D.ietf-mmusic-ice] 5397 Rosenberg, J., "Interactive Connectivity Establishment 5398 (ICE): A Protocol for Network Address Translator (NAT) 5399 Traversal for Offer/Answer Protocols", 5400 draft-ietf-mmusic-ice-19 (work in progress), October 2007. 5402 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 5403 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 5404 October 2008. 5406 [I-D.ietf-behave-turn] 5407 Rosenberg, J., Mahy, R., and P. Matthews, "Traversal Using 5408 Relays around NAT (TURN): Relay Extensions to Session 5409 Traversal Utilities for NAT (STUN)", 5410 draft-ietf-behave-turn-12 (work in progress), 5411 November 2008. 5413 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 5414 (CMC): Transport Protocols", RFC 5273, June 2008. 5416 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 5417 (CMC)", RFC 5272, June 2008. 5419 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 5420 for Transport Layer Security (TLS)", RFC 4279, 5421 December 2005. 5423 [I-D.ietf-mmusic-ice-tcp] 5424 Rosenberg, J., "TCP Candidates with Interactive 5425 Connectivity Establishment (ICE)", 5426 draft-ietf-mmusic-ice-tcp-07 (work in progress), 5427 July 2008. 5429 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 5430 Security", RFC 4347, April 2006. 5432 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 5433 Friendly Rate Control (TFRC): Protocol Specification", 5434 RFC 5348, September 2008. 5436 16.2. Informative References 5438 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 5439 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 5440 April 2007. 5442 [I-D.ietf-p2psip-concepts] 5443 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 5444 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 5445 draft-ietf-p2psip-concepts-02 (work in progress), 5446 July 2008. 5448 [RFC1122] Braden, R., "Requirements for Internet Hosts - 5449 Communication Layers", STD 3, RFC 1122, October 1989. 5451 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 5452 A., Peterson, J., Sparks, R., Handley, M., and E. 5453 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 5454 June 2002. 5456 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 5457 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 5458 RFC 5382, October 2008. 5460 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 5461 the Session Description Protocol (SDP)", RFC 4145, 5462 September 2005. 5464 [RFC4571] Lazzaro, J., "Framing Real-time Transport Protocol (RTP) 5465 and RTP Control Protocol (RTCP) Packets over Connection- 5466 Oriented Transport", RFC 4571, July 2006. 5468 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 5470 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 5471 Requirements for Security", BCP 106, RFC 4086, June 2005. 5473 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 5474 "Using the Secure Remote Password (SRP) Protocol for TLS 5475 Authentication", RFC 5054, November 2007. 5477 [RFC3280] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet 5478 X.509 Public Key Infrastructure Certificate and 5479 Certificate Revocation List (CRL) Profile", RFC 3280, 5480 April 2002. 5482 [I-D.matthews-p2psip-bootstrap-mechanisms] 5483 Cooper, E., "Bootstrap Mechanisms for P2PSIP", 5484 draft-matthews-p2psip-bootstrap-mechanisms-00 (work in 5485 progress), February 2007. 5487 [I-D.garcia-p2psip-dns-sd-bootstrapping] 5488 Garcia, G., "P2PSIP bootstrapping using DNS-SD", 5489 draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in 5490 progress), October 2007. 5492 [I-D.pascual-p2psip-clients] 5493 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 5494 Yongchao, "P2PSIP Clients", 5495 draft-pascual-p2psip-clients-01 (work in progress), 5496 February 2008. 5498 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 5499 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 5500 RFC 4787, January 2007. 5502 [I-D.jiang-p2psip-sep] 5503 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 5504 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 5505 February 2008. 5507 [I-D.zheng-p2psip-diagnose] 5508 Yongchao, S., Zhang, H., and X. Jiang, "Diagnose P2PSIP 5509 Overlay Network Failures", draft-zheng-p2psip-diagnose-03 5510 (work in progress), November 2008. 5512 [I-D.hardie-p2poverlay-pointers] 5513 Hardie, T., "Mechanisms for use in pointing to overlay 5514 networks, nodes, or resources", 5515 draft-hardie-p2poverlay-pointers-00 (work in progress), 5516 January 2008. 5518 [I-D.ietf-p2psip-sip] 5519 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 5520 H. Schulzrinne, "A SIP Usage for RELOAD", 5521 draft-ietf-p2psip-sip-00 (work in progress), October 2008. 5523 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 5525 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 5526 "Eclipse Attacks on Overlay Networks: Threats and 5527 Defenses", INFOCOM 2006, April 2006. 5529 [non-transitive-dhts-worlds05] 5530 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 5531 Stoica, "Non-Transitive Connectivity and DHTs", 5532 WORLDS'05. 5534 [lookups-churn-p2p06] 5535 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 5536 Improving DHT Lookup Performance under Churn", IEEE 5537 P2P'06. 5539 [bryan-design-hotp2p08] 5540 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 5541 a Versatile, Secure P2PSIP Communications Architecture for 5542 the Public Internet", Hot-P2P'08. 5544 [opendht-sigcomm05] 5545 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 5546 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 5547 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 5549 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 5550 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 5551 Scalable Peer-to-peer Lookup Service for Internet 5552 Applications", IEEE/ACM Transactions on Networking Volume 5553 11, Issue 1, 17-32, Feb 2003. 5555 [vulnerabilities-acsac04] 5556 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 5557 Threats in Structured Peer-to-Peer Systems: A Quantitative 5558 Analysis", ACSAC 2004. 5560 [handling-churn-usenix04] 5561 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 5562 "Handling Churn in a DHT", USENIX 2004. 5564 [minimizing-churn-sigcomm06] 5565 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 5566 in Distributed Systems", SIGCOMM 2006. 5568 Appendix A. Change Log 5570 A.1. Changes since draft-ietf-p2psip-reload-00 5572 o Split base protocol from combined draft into new draft. 5573 o Update architecture discussion to address concerns raised about 5574 clarity of roles. 5576 o Moved extensive discussion of routing and client behaviors to 5577 appendix. 5578 o Split Ping into Ping and Probe 5579 o Added AttachLite to provide way to implement ICE-Lite 5580 o added Stat call for retrieving meta-data 5581 o added discussion of periodic vs reactive recovery issue 5582 o changed finger table stabilization to prefer long-lived over best- 5583 match 5584 o removed mDNS discovery method 5585 o updated IANA considerations to be more complete 5586 o changed error codes from http-based 5588 A.2. Changes since draft-ietf-p2psip-base-00 5590 o removed TUNNEL method 5591 o allow implementations more flexibility in picking finger table 5592 entry and revise random range 5593 o decouple overlay configuration from enrollment server 5594 o add error for data too large 5595 o change architecture to overlay perspective from previous revision 5596 and update terminology in document to match 5598 Appendix B. Routing Alternatives 5600 Significant discussion has been focused on the selection of a routing 5601 algorithm for P2PSIP. This section discusses the motivations for 5602 selection of symmetric recursive routing for RELOAD and describes the 5603 extensions that would be required to support additional routing 5604 algorithms. 5606 B.1. Iterative vs Recursive 5608 Iterative routing has a number of advantages. It is easier to debug, 5609 consumes fewer resources on intermediate peers, and allows the 5610 querying peer to identify and route around misbehaving peers 5611 [non-transitive-dhts-worlds05]. However, in the presence of NATs 5612 iterative routing is intolerably expensive because a new connection 5613 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 5615 Iterative routing is supported through the Route_Query mechanism and 5616 is primarily intended for debugging. It is also allows the querying 5617 peer to evaluate the routing decisions made by the peers at each hop, 5618 consider alternatives, and perhaps detect at what point the 5619 forwarding path fails. 5621 B.2. Symmetric vs Forward response 5623 An alternative to the symmetric recursive routing method used by 5624 RELOAD is Forward-Only routing, where the response is routed to the 5625 requester as if it is a new message initiating by the responder (in 5626 the previous example, Z sends the response to A as if it were sending 5627 a request). Forward-only routing requires no state in either the 5628 message or intermediate peers. 5630 The drawback of forward-only routing is that it does not work when 5631 the overlay is unstable. For example, if A is in the process of 5632 joining the overlay and is sending a Join request to Z, it is not yet 5633 reachable via forward routing. Even if it is established in the 5634 overlay, if network failures produce temporary instability, A may not 5635 be reachable (and may be trying to stabilize its network connectivity 5636 via Attach messages). 5638 Furthermore, forward-only responses are less likely to reach the 5639 querying peer than symmetric recursive because the forward path is 5640 more likely to have a failed peer than the request path (which was 5641 just tested to route the request) [non-transitive-dhts-worlds05]. 5643 An extension to RELOAD that supports forward-only routing but relies 5644 on symmetric responses as a fallback would be possible, but due to 5645 the complexities of determining when to use forward-only and when to 5646 fallback to symmetric, we have chosen not to include it as an option 5647 at this point. 5649 B.3. Direct Response 5651 Another routing option is Direct Response routing, in which the 5652 response is returned directly to the querying node. In the previous 5653 example, if A encodes its IP address in the request, then Z can 5654 simply deliver the response directly to A. In the absence of NATs or 5655 other connectivity issues, this is the optimal routing technique. 5657 The challenge of implementing direct response is the presence of 5658 NATs. There are a number of complexities that must be addressed. In 5659 this discussion, we will continue our assumption that A issued the 5660 request and Z is generating the response. 5662 o The IP address listed by A may be unreachable, either due to NAT 5663 or firewall rules. Therefore, a direct response technique must 5664 fallback to symmetric response [non-transitive-dhts-worlds05]. 5665 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 5666 received the message (and the TLS negotiation will provide earlier 5667 confirmation that A is reachable), but this fallback requires a 5668 timeout that will increase the response latency whenever A is not 5669 reachable from Z. 5670 o Whenever A is behind a NAT it will have multiple candidate IP 5671 addresses, each of which must be advertised to ensure 5672 connectivity, therefore Z will need to attempt multiple 5673 connections to deliver the response. 5674 o One (or all) of A's candidate addresses may route from Z to a 5675 different device on the Internet. In the worst case these nodes 5676 may actually be running RELOAD on the same port. Therefore, 5677 establishing a secure connection to authenticate A before 5678 delivering the response is absolutely necessary. This step 5679 diminishes the efficiency of direct response because multiple 5680 roundtrips are required before the message can be delivered. 5681 o If A is behind a NAT and does not have a connection already 5682 established with Z, there are only two ways the direct response 5683 will work. The first is that A and Z are both behind the same 5684 NAT, in which case the NAT is not involved. In the more common 5685 case, when Z is outside A's NAT, the response will only be 5686 received if A's NAT implements endpoint-independent filtering. As 5687 the choice of filtering mode conflates application transparency 5688 with security [RFC4787], and no clear recommendation is available, 5689 the prevalence of this feature in future devices remains unclear. 5691 An extension to RELOAD that supports direct response routing but 5692 relies on symmetric responses as a fallback would be possible, but 5693 due to the complexities of determining when to use direct response 5694 and when to fallback to symmetric, and the reduced performance for 5695 responses to peers behind restrictive NATs, we have chosen not to 5696 include it as an option at this point. 5698 B.4. Relay Peers 5700 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 5701 response by having A identify a peer, Q, that will be directly 5702 reachable by any other peer. A uses Attach to establish a connection 5703 with Q and advertises Q's IP address in the request sent to Z. Z 5704 sends the response to Q, which relays it to A. This then reduces the 5705 latency to two hops, plus Z negotiating a secure connection to Q. 5707 This technique relies on the relative population of nodes such as A 5708 that require relay peers and peers such as Q that are capable of 5709 serving as a relay peer. It also requires nodes to be able to 5710 identify which category they are in. This identification problem has 5711 turned out to be hard to solve and is still an open area of 5712 exploration. 5714 An extension to RELOAD that supports relay peers is possible, but due 5715 to the complexities of implementing such an alternative, we have not 5716 added such a feature to RELOAD at this point. 5718 A concept similar to relay peers, essentially choosing a relay peer 5719 at random, has previously been suggested to solve problems of 5720 pairwise non-transitivity [non-transitive-dhts-worlds05], but 5721 deterministic filtering provided by NATs make random relay peers no 5722 more likely to work than the responding peer. 5724 B.5. Symmetric Route Stability 5726 A common concern about symmetric recursive routing has been that one 5727 or more peers along the request path may fail before the response is 5728 received. The significance of this problem essentially depends on 5729 the response latency of the overlay. An overlay that produces slow 5730 responses will be vulnerable to churn, whereas responses that are 5731 delivered very quickly are vulnerable only to failures that occur 5732 over that small interval. 5734 The other aspect of this issue is whether the request itself can be 5735 successfully delivered. Assuming typical connection maintenance 5736 intervals, the time period between the last maintenance and the 5737 request being sent will be orders of magnitude greater than the delay 5738 between the request being forwarded and the response being received. 5739 Therefore, if the path was stable enough to be available to route the 5740 request, it is almost certainly going to remain available to route 5741 the response. 5743 An overlay that is unstable enough to suffer this type of failure 5744 frequently is unlikely to be able to support reliable functionality 5745 regardless of the routing mechanism. However, regardless of the 5746 stability of the return path, studies show that in the event of high 5747 churn, iterative routing is a better solution to ensure request 5748 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 5750 Finally, because RELOAD retries the end-to-end request, that retry 5751 will address the issues of churn that remain. 5753 Appendix C. Why Clients? 5755 There are a wide variety of reasons a node may act as a client rather 5756 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 5757 some of those scenarios and how the client's behavior changes based 5758 on its capabilities. 5760 C.1. Why Not Only Peers? 5762 For a number of reasons, a particular node may be forced to act as a 5763 client even though it is willing to act as a peer. These include: 5765 o The node does not have appropriate network connectivity, typically 5766 because it has a low-bandwidth network connection. 5767 o The node may not have sufficient resources, such as computing 5768 power, storage space, or battery power. 5769 o The overlay algorithm may dictate specific requirements for peer 5770 selection. These may include participation in the overlay to 5771 determine trustworthiness, control the number of peers in the 5772 overlay to reduce overly-long routing paths, or ensure minimum 5773 application uptime before a node can join as a peer. 5775 The ultimate criteria for a node to become a peer are determined by 5776 the overlay algorithm and specific deployment. A node acting as a 5777 client that has a full implementation of RELOAD and the appropriate 5778 overlay algorithm is capable of locating its responsible peer in the 5779 overlay and using CONNECT to establish a direct connection to that 5780 peer. In that way, it may elect to be reachable under either of the 5781 routing approaches listed above. Particularly for overlay algorithms 5782 that elect nodes to serve as peers based on trustworthiness or 5783 population, the overlay algorithm may require such a client to locate 5784 itself at a particular place in the overlay. 5786 C.2. Clients as Application-Level Agents 5788 SIP defines an extensive protocol for registration and security 5789 between a client and its registrar/proxy server(s). Any SIP device 5790 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 5791 peer that implements the server-side functionality required by the 5792 SIP protocol. In this case, the peer would be acting as if it were 5793 the user's peer, and would need the appropriate credentials for that 5794 user. 5796 Application-level support for clients is defined by a usage. A usage 5797 offering support for application-level clients should specify how the 5798 security of the system is maintained when the data is moved between 5799 the application and RELOAD layers. 5801 Authors' Addresses 5803 Cullen Jennings 5804 Cisco 5805 170 West Tasman Drive 5806 MS: SJC-21/2 5807 San Jose, CA 95134 5808 USA 5810 Phone: +1 408 421-9990 5811 Email: fluffy@cisco.com 5813 Bruce B. Lowekamp (editor) 5814 unaffiliated 5815 2790 Linden Ln 5816 Williamsburg, VA 23185 5817 USA 5819 Email: bbl@lowekamp.net 5821 Eric Rescorla 5822 Network Resonance 5823 2064 Edgewood Drive 5824 Palo Alto, CA 94303 5825 USA 5827 Phone: +1 650 320-8549 5828 Email: ekr@networkresonance.com 5830 Salman A. Baset 5831 Columbia University 5832 1214 Amsterdam Avenue 5833 New York, NY 5834 USA 5836 Email: salman@cs.columbia.edu 5837 Henning Schulzrinne 5838 Columbia University 5839 1214 Amsterdam Avenue 5840 New York, NY 5841 USA 5843 Email: hgs@cs.columbia.edu 5845 Full Copyright Statement 5847 Copyright (C) The IETF Trust (2008). 5849 This document is subject to the rights, licenses and restrictions 5850 contained in BCP 78, and except as set forth therein, the authors 5851 retain all their rights. 5853 This document and the information contained herein are provided on an 5854 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 5855 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 5856 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 5857 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 5858 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 5859 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 5861 Intellectual Property 5863 The IETF takes no position regarding the validity or scope of any 5864 Intellectual Property Rights or other rights that might be claimed to 5865 pertain to the implementation or use of the technology described in 5866 this document or the extent to which any license under such rights 5867 might or might not be available; nor does it represent that it has 5868 made any independent effort to identify any such rights. Information 5869 on the procedures with respect to rights in RFC documents can be 5870 found in BCP 78 and BCP 79. 5872 Copies of IPR disclosures made to the IETF Secretariat and any 5873 assurances of licenses to be made available, or the result of an 5874 attempt made to obtain a general license or permission for the use of 5875 such proprietary rights by implementers or users of this 5876 specification can be obtained from the IETF on-line IPR repository at 5877 http://www.ietf.org/ipr. 5879 The IETF invites any interested party to bring to its attention any 5880 copyrights, patents or patent applications, or other proprietary 5881 rights that may cover technology that may be required to implement 5882 this standard. Please address the information to the IETF at 5883 ietf-ipr@ietf.org.