idnits 2.17.1 draft-ietf-p2psip-base-08.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Sep 2009 rather than the newer Notice from 28 Dec 2009. (See https://trustee.ietf.org/license-info/) Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 2 instances of too long lines in the document, the longest one being 2 characters in excess of 72. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1813 has weird spacing: '...Options optio...' == Line 2077 has weird spacing: '...hReqAns con...' == Line 2114 has weird spacing: '...ionType type;...' == Line 2255 has weird spacing: '...te_type typ...' == Line 2313 has weird spacing: '...tyValue ide...' == (5 more instances...) == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: multicast-bootstrap This element represents the address of a multicast, broadcast, or anycast address and port that may be used for bootstrap. Nodes SHOULD listen on the address. It has an attributed called "address" that represents the IP address and an attribute called "port" that represents the port. More than one "multicast-bootstrap" element may be present. clients-permitted This element represents whether clients are permitted or whether all nodes must be peers. If it is set to "TRUE" or absent, this indicates that clients are permitted. If it is set to "FALSE" then nodes MUST join as peers. ice-lite-permitted This element represents whether nodes are allowed to use the "no-ICE" Overlay Link protocols. in this overlay. If it is absent, it is treated as if it were set to "FALSE". chord-update-interval The update frequency for the Chord-reload topology plugin (see Section 9). chord-ping-interval The ping frequency for the Chord-reload topology plugin (see Section 9). chord-reload-reactive Whether reactive recovery should be used for this overlay. (see Section 9). shared-secret If shared secret mode is used, this contains the shared secret. max-message-size Maximum size in bytes of any message in the overlay. If this value is not present, the default is 5000. initial-ttl Initial default TTL (time to live, see Section 5.3.2) for messages. If this value is not present, the default is 100. kind-signer This contains a single Node-ID in hexadecimal and indicates that the certificate with this Node-ID is allowed to sign kinds. Identifying kind-signer by Node-ID instead of certificate allows the use of short lived certificates without constantly having to provide an updated configuration file. bad-node This contains a single Node-ID in hexadecimal and indicates that the certificate with this Node-ID MUST not be considered valid. This allows certificate revocation. -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 7, 2010) is 5163 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 1715 -- Looks like a reference, but probably isn't: '0' on line 4485 == Missing Reference: 'RFC-AAAA' is mentioned on line 6043, but not defined ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) ** Obsolete normative reference: RFC 2988 (Obsoleted by RFC 6298) ** Obsolete normative reference: RFC 4395 (Obsoleted by RFC 7595) == Outdated reference: A later version (-16) exists of draft-ietf-mmusic-ice-tcp-07 -- Obsolete informational reference (is this intentional?): RFC 5201 (Obsoleted by RFC 7401) == Outdated reference: A later version (-09) exists of draft-ietf-p2psip-concepts-02 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-01 Summary: 7 errors (**), 0 flaws (~~), 12 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: September 8, 2010 Skype 6 E. Rescorla 7 Network Resonance 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 March 7, 2010 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-08 16 Abstract 18 In this document the term BCP 78 and BCP 79 refer to RFC 3978 and RFC 19 3979 respectively. They refer only to those RFCs and not to any 20 documents that update or supersede them. 22 This specification defines REsource LOcation And Discovery (RELOAD), 23 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 24 P2P signaling protocol provides its clients with an abstract storage 25 and messaging service between a set of cooperating peers that form 26 the overlay network. RELOAD is designed to support a P2P Session 27 Initiation Protocol (P2PSIP) network, but can be utilized by other 28 applications with similar requirements by defining new usages that 29 specify the kinds of data that must be stored for a particular 30 application. RELOAD defines a security model based on a certificate 31 enrollment service that provides unique identities. NAT traversal is 32 a fundamental service of the protocol. RELOAD also allows access 33 from "client" nodes that do not need to route traffic or store data 34 for others. 36 Legal 38 This documents and the information contained therein are provided on 39 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 40 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 41 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 42 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 43 WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE 44 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 45 FOR A PARTICULAR PURPOSE. 47 Status of this Memo 48 This Internet-Draft is submitted to IETF in full conformance with the 49 provisions of BCP 78 and BCP 79. 51 Internet-Drafts are working documents of the Internet Engineering 52 Task Force (IETF), its areas, and its working groups. Note that 53 other groups may also distribute working documents as Internet- 54 Drafts. 56 Internet-Drafts are draft documents valid for a maximum of six months 57 and may be updated, replaced, or obsoleted by other documents at any 58 time. It is inappropriate to use Internet-Drafts as reference 59 material or to cite them other than as "work in progress." 61 The list of current Internet-Drafts can be accessed at 62 http://www.ietf.org/ietf/1id-abstracts.txt. 64 The list of Internet-Draft Shadow Directories can be accessed at 65 http://www.ietf.org/shadow.html. 67 This Internet-Draft will expire on September 8, 2010. 69 Copyright Notice 71 Copyright (c) 2010 IETF Trust and the persons identified as the 72 document authors. All rights reserved. 74 This document is subject to BCP 78 and the IETF Trust's Legal 75 Provisions Relating to IETF Documents 76 (http://trustee.ietf.org/license-info) in effect on the date of 77 publication of this document. Please review these documents 78 carefully, as they describe your rights and restrictions with respect 79 to this document. Code Components extracted from this document must 80 include Simplified BSD License text as described in Section 4.e of 81 the Trust Legal Provisions and are provided without warranty as 82 described in the BSD License. 84 This document may contain material from IETF Documents or IETF 85 Contributions published or made publicly available before November 86 10, 2008. The person(s) controlling the copyright in some of this 87 material may not have granted the IETF Trust the right to allow 88 modifications of such material outside the IETF Standards Process. 89 Without obtaining an adequate license from the person(s) controlling 90 the copyright in such materials, this document may not be modified 91 outside the IETF Standards Process, and derivative works of it may 92 not be created outside the IETF Standards Process, except to format 93 it for publication as an RFC or to translate it into languages other 94 than English. 96 Table of Contents 98 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 99 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 100 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 101 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 102 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 103 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 14 104 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 105 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 106 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 16 107 1.4. Structure of This Document . . . . . . . . . . . . . . . 17 108 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 109 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 20 110 3.1. Security and Identification . . . . . . . . . . . . . . 20 111 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 21 112 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 21 113 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 22 114 3.2.2. Minimum Functionality Requirements for Clients . . . 22 115 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 23 116 3.4. Connectivity Management . . . . . . . . . . . . . . . . 25 117 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 26 118 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 26 119 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 26 120 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 28 121 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 28 122 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 28 123 4. Application Support Overview . . . . . . . . . . . . . . . . 29 124 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 29 125 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 30 126 4.1.2. Usages . . . . . . . . . . . . . . . . . . . . . . . 31 127 4.1.3. Replication . . . . . . . . . . . . . . . . . . . . 31 128 4.2. Service Discovery . . . . . . . . . . . . . . . . . . . 32 129 4.3. Application Connectivity . . . . . . . . . . . . . . . . 32 130 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 33 131 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 33 132 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 33 133 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 34 134 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 35 135 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 35 136 5.2.1. Request Origination . . . . . . . . . . . . . . . . 35 137 5.2.2. Response Origination . . . . . . . . . . . . . . . . 36 138 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 37 139 5.3.1. Presentation Language . . . . . . . . . . . . . . . 37 140 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 38 141 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 40 142 5.3.2.1. Processing Configuration Sequence Numbers . . . . 42 143 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 43 144 5.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 45 145 5.3.2.4. Direct Return Response Forwarding Options . . . . 46 146 5.3.3. Message Contents Format . . . . . . . . . . . . . . 47 147 5.3.3.1. Response Codes and Response Errors . . . . . . . 48 148 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 50 149 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 53 150 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 53 151 5.4.2. Methods and types for use by topology plugins . . . 54 152 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 54 153 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 55 154 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 55 155 5.4.2.4. Route_Query . . . . . . . . . . . . . . . . . . . 56 156 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 57 157 5.5. Forwarding and Link Management Layer . . . . . . . . . . 59 158 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 59 159 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 60 160 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 62 161 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 62 162 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 62 163 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 63 164 5.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 64 165 5.5.1.7. Encoding the Attach Message . . . . . . . . . . . 64 166 5.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 65 167 5.5.1.9. Role Determination . . . . . . . . . . . . . . . 65 168 5.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 65 169 5.5.1.11. No ICE . . . . . . . . . . . . . . . . . . . . . 66 170 5.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 66 171 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 66 172 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 67 173 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 67 174 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 67 175 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 68 176 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 68 177 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 68 178 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 68 179 5.5.4. Config_Update . . . . . . . . . . . . . . . . . . . 69 180 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 69 181 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 70 182 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 71 183 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 72 184 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 72 185 5.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 72 186 5.6.1.3. Message-oriented Transports . . . . . . . . . . . 72 187 5.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 72 188 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 73 189 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 74 190 5.6.3.1. Retransmission and Flow Control . . . . . . . . . 75 191 5.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 76 192 5.6.5. TLS/TCP with FH, no ICE . . . . . . . . . . . . . . 76 193 5.6.6. DTLS/UDP with SR, no ICE . . . . . . . . . . . . . . 77 194 5.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 77 195 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 78 196 6.1. Data Signature Computation . . . . . . . . . . . . . . . 79 197 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 80 198 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 81 199 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 82 200 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 82 201 6.3. Access Control Policies . . . . . . . . . . . . . . . . 83 202 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 83 203 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 83 204 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 83 205 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 83 206 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 84 207 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 84 208 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 84 209 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 88 210 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 89 211 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 90 212 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 91 213 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 93 214 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 93 215 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 94 216 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 94 217 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 96 218 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 96 219 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 96 220 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 97 221 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 98 222 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 99 223 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 100 224 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 101 225 9.2. Routing . . . . . . . . . . . . . . . . . . . . . . . . 102 226 9.3. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 102 227 9.4. Joining . . . . . . . . . . . . . . . . . . . . . . . . 103 228 9.5. Routing Attaches . . . . . . . . . . . . . . . . . . . . 103 229 9.6. Updates . . . . . . . . . . . . . . . . . . . . . . . . 104 230 9.6.1. Handling Neighbor Failures . . . . . . . . . . . . . 105 231 9.6.2. Handling Finger Table Entry Failure . . . . . . . . 106 232 9.6.3. Receiving Updates . . . . . . . . . . . . . . . . . 106 233 9.6.4. Stabilization . . . . . . . . . . . . . . . . . . . 107 234 9.6.4.1. Updating neighbor table . . . . . . . . . . . . . 107 235 9.6.4.2. Refreshing finger table . . . . . . . . . . . . . 107 236 9.6.4.3. Adjusting finger table size . . . . . . . . . . . 108 237 9.6.4.4. Detecting partitioning . . . . . . . . . . . . . 109 238 9.7. Route Query . . . . . . . . . . . . . . . . . . . . . . 109 239 9.8. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 110 241 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 111 242 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 111 243 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 116 244 10.2. Discovery Through Enrollment Server . . . . . . . . . . 118 245 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 118 246 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 119 247 10.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 120 248 10.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 120 249 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 121 250 12. Security Considerations . . . . . . . . . . . . . . . . . . . 127 251 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 127 252 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 128 253 12.3. Certificate-based Security . . . . . . . . . . . . . . . 128 254 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 129 255 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 130 256 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 130 257 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 131 258 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 131 259 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 131 260 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 132 261 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 132 262 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 133 263 12.6.3. Peer Identification and Authentication . . . . . . . 133 264 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 134 265 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 134 266 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 135 267 13.1. Port Registrations . . . . . . . . . . . . . . . . . . . 135 268 13.2. Overlay Algorithm Types . . . . . . . . . . . . . . . . 135 269 13.3. Access Control Policies . . . . . . . . . . . . . . . . 135 270 13.4. Application-ID . . . . . . . . . . . . . . . . . . . . . 136 271 13.5. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 136 272 13.6. Data Model . . . . . . . . . . . . . . . . . . . . . . . 137 273 13.7. Message Codes . . . . . . . . . . . . . . . . . . . . . 137 274 13.8. Error Codes . . . . . . . . . . . . . . . . . . . . . . 138 275 13.9. Overlay Link Types . . . . . . . . . . . . . . . . . . . 139 276 13.10. Forwarding Options . . . . . . . . . . . . . . . . . . . 139 277 13.11. Probe Information Types . . . . . . . . . . . . . . . . 140 278 13.12. Message Extensions . . . . . . . . . . . . . . . . . . . 140 279 13.13. reload URI Scheme . . . . . . . . . . . . . . . . . . . 140 280 13.13.1. URI Registration . . . . . . . . . . . . . . . . . . 141 281 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 141 282 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 142 283 15.1. Normative References . . . . . . . . . . . . . . . . . . 142 284 15.2. Informative References . . . . . . . . . . . . . . . . . 143 285 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 146 286 A.1. Changes since draft-ietf-p2psip-reload-04 . . . . . . . 146 287 A.2. Changes since draft-ietf-p2psip-reload-01 . . . . . . . 146 288 A.3. Changes since draft-ietf-p2psip-reload-00 . . . . . . . 147 289 A.4. Changes since draft-ietf-p2psip-base-00 . . . . . . . . 147 290 A.5. Changes since draft-ietf-p2psip-base-01 . . . . . . . . 147 291 A.6. Changes since draft-ietf-p2psip-base-01a . . . . . . . . 147 292 A.7. Changes since draft-ietf-p2psip-base-02 . . . . . . . . 148 293 Appendix B. Routing Alternatives . . . . . . . . . . . . . . . . 148 294 B.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 148 295 B.2. Symmetric vs Forward response . . . . . . . . . . . . . 148 296 B.3. Direct Response . . . . . . . . . . . . . . . . . . . . 149 297 B.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 150 298 B.5. Symmetric Route Stability . . . . . . . . . . . . . . . 151 299 Appendix C. Why Clients? . . . . . . . . . . . . . . . . . . . . 151 300 C.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 151 301 C.2. Clients as Application-Level Agents . . . . . . . . . . 152 302 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 152 304 1. Introduction 306 This document defines REsource LOcation And Discovery (RELOAD), a 307 peer-to-peer (P2P) signaling protocol for use on the Internet. It 308 provides a generic, self-organizing overlay network service, allowing 309 nodes to efficiently route messages to other nodes and to efficiently 310 store and retrieve data in the overlay. RELOAD provides several 311 features that are critical for a successful P2P protocol for the 312 Internet: 314 Security Framework: A P2P network will often be established among a 315 set of peers that do not trust each other. RELOAD leverages a 316 central enrollment server to provide credentials for each peer 317 which can then be used to authenticate each operation. This 318 greatly reduces the possible attack surface. 320 Usage Model: RELOAD is designed to support a variety of 321 applications, including P2P multimedia communications with the 322 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 323 the definition of new application usages, each of which can define 324 its own data types, along with the rules for their use. This 325 allows RELOAD to be used with new applications through a simple 326 documentation process that supplies the details for each 327 application. 329 NAT Traversal: RELOAD is designed to function in environments where 330 many if not most of the nodes are behind NATs or firewalls. 331 Operations for NAT traversal are part of the base design, 332 including using ICE to establish new RELOAD or application 333 protocol connections. 335 High Performance Routing: The very nature of overlay algorithms 336 introduces a requirement that peers participating in the P2P 337 network route requests on behalf of other peers in the network. 338 This introduces a load on those other peers, in the form of 339 bandwidth and processing power. RELOAD has been defined with a 340 simple, lightweight forwarding header, thus minimizing the amount 341 of effort required by intermediate peers. 343 Pluggable Overlay Algorithms: RELOAD has been designed with an 344 abstract interface to the overlay layer to simplify implementing a 345 variety of structured (DHT) and unstructured overlay algorithms. 346 This specification also defines how RELOAD is used with Chord, 347 which is mandatory to implement. Specifying a default "must 348 implement" overlay algorithm promotes interoperability, while 349 extensibility allows selection of overlay algorithms optimized for 350 a particular application. 352 These properties were designed specifically to meet the requirements 353 for a P2P protocol to support SIP. This document defines the base 354 protocol for the distributed storage and location service, as well as 355 critical usages for NAT traversal and security. The SIP Usage itself 356 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 357 limited to usage by SIP and could serve as a tool for supporting 358 other P2P applications with similar needs. RELOAD is also based on 359 the concepts introduced in [I-D.ietf-p2psip-concepts]. 361 1.1. Basic Setting 363 In this section, we provide a brief overview of the operational 364 setting for RELOAD. See the concepts document for more details. A 365 RELOAD Overlay Instance consists of a set of nodes arranged in a 366 partly connected graph. Each node in the overlay is assigned a 367 numeric Node-ID which, together with the specific overlay algorithm 368 in use, determines its position in the graph and the set of nodes it 369 connects to. The figure below shows a trivial example which isn't 370 drawn from any particular overlay algorithm, but was chosen for 371 convenience of representation. 373 +--------+ +--------+ +--------+ 374 | Node 10|--------------| Node 20|--------------| Node 30| 375 +--------+ +--------+ +--------+ 376 | | | 377 | | | 378 +--------+ +--------+ +--------+ 379 | Node 40|--------------| Node 50|--------------| Node 60| 380 +--------+ +--------+ +--------+ 381 | | | 382 | | | 383 +--------+ +--------+ +--------+ 384 | Node 70|--------------| Node 80|--------------| Node 90| 385 +--------+ +--------+ +--------+ 386 | 387 | 388 +--------+ 389 | Node 85| 390 |(Client)| 391 +--------+ 393 Because the graph is not fully connected, when a node wants to send a 394 message to another node, it may need to route it through the network. 395 For instance, Node 10 can talk directly to nodes 20 and 40, but not 396 to Node 70. In order to send a message to Node 70, it would first 397 send it to Node 40 with instructions to pass it along to Node 70. 398 Different overlay algorithms will have different connectivity graphs, 399 but the general idea behind all of them is to allow any node in the 400 graph to efficiently reach every other node within a small number of 401 hops. 403 The RELOAD network is not only a messaging network. It is also a 404 storage network. Records are stored under numeric addresses which 405 occupy the same space as node identifiers. Peers are responsible for 406 storing the data associated with some set of addresses as determined 407 by their Node-ID. For instance, we might say that every peer is 408 responsible for storing any data value which has an address less than 409 or equal to its own Node-ID, but greater than the next lowest 410 Node-ID. Thus, Node-20 would be responsible for storing values 411 11-20. 413 RELOAD also supports clients. These are nodes which have Node-IDs 414 but do not participate in routing or storage. For instance, in the 415 figure above Node 85 is a client. It can route to the rest of the 416 RELOAD network via Node 80, but no other node will route through it 417 and Node 90 is still responsible for all addresses between 81-90. We 418 refer to non-client nodes as peers. 420 Other applications (for instance, SIP) can be defined on top of 421 RELOAD and use these two basic RELOAD services to provide their own 422 services. 424 1.2. Architecture 426 RELOAD is fundamentally an overlay network. Therefore, it can be 427 divided into components that mimic the layering of the Internet 428 model[RFC1122]. 430 Application 432 +-------+ +-------+ 433 | SIP | | XMPP | ... 434 | Usage | | Usage | 435 +-------+ +-------+ 436 -------------------------------------- Messaging API 437 +------------------+ +---------+ 438 | Message |<--->| Storage | 439 | Transport | +---------+ 440 +------------------+ ^ 441 ^ ^ | 442 | v v 443 | +-------------------+ 444 | | Topology | 445 | | Plugin | 446 | +-------------------+ 447 | ^ 448 v v 449 +------------------+ 450 | Forwarding & | 451 | Link Management | 452 +------------------+ 453 -------------------------------------- Overlay Link API 454 +-------+ +------+ 455 |TLS | |DTLS | ... 456 +-------+ +------+ 458 The major components of RELOAD are: 460 Usage Layer: Each application defines a RELOAD usage; a set of data 461 kinds and behaviors which describe how to use the services 462 provided by RELOAD. These usages all talk to RELOAD through a 463 common Message Transport API. 465 Message Transport: Handles end-to-end reliability, manages request 466 state for the usages, and forwards Store and Fetch operations to 467 the Storage component. Delivers message responses to the 468 component initiating the request. 470 Storage: The Storage component is responsible for processing 471 messages relating to the storage and retrieval of data. It talks 472 directly to the Topology Plugin to manage data replication and 473 migration, and it talks to the Message Transport component to send 474 and receive messages. 476 Topology Plugin: The Topology Plugin is responsible for implementing 477 the specific overlay algorithm being used. It uses the Message 478 Transport component to send and receive overlay management 479 messages, to the Storage component to manage data replication, and 480 directly to the Forwarding Layer to control hop-by-hop message 481 forwarding. This component closely parallels conventional routing 482 algorithms, but is more tightly coupled to the Forwarding Layer 483 because there is no single "routing table" equivalent used by all 484 overlay algorithms. 486 Forwarding and Link Management Layer: Stores and implements the 487 routing table by providing packet forwarding services between 488 nodes. It also handles establishing new links between nodes, 489 including setting up connections across NATs using ICE. 491 Overlay Link Layer: TLS [RFC5246] and DTLS [RFC4347] are the "link 492 layer" protocols used by RELOAD for hop-by-hop communication. 493 Each such protocol includes the appropriate provisions for per-hop 494 framing or hop-by-hop ACKs required by unreliable transports. 496 To further clarify the roles of the various layers, this figure 497 parallels the architecture with each layer's role from an overlay 498 perspective and implementation layer in the internet: 500 | Internet Model | 501 Real | Equivalent | Reload 502 Internet | in Overlay | Architecture 503 --------------+-----------------+------------------------------------ 504 | | +-------+ +-------+ 505 | Application | | SIP | | XMPP | ... 506 | | | Usage | | Usage | 507 | | +-------+ +-------+ 508 | | ---------------------------------- 509 | |+------------------+ +---------+ 510 | Transport || Message |<--->| Storage | 511 | || Transport | +---------+ 512 | |+------------------+ ^ 513 | | ^ ^ | 514 | | | v v 515 Application | | | +-------------------+ 516 | (Routing) | | | Topology | 517 | | | | Plugin | 518 | | | +-------------------+ 519 | | | ^ 520 | | v v 521 | Network | +------------------+ 522 | | | Forwarding & | 523 | | | Link Management | 524 | | +------------------+ 525 | | ---------------------------------- 526 Transport | Link | +-------+ +------+ 527 | | |TLS | |DTLS | ... 528 | | +-------+ +------+ 529 --------------+-----------------+------------------------------------ 530 Network | 531 | 532 Link | 534 1.2.1. Usage Layer 536 The top layer, called the Usage Layer, has application usages, such 537 as the SIP Location Usage, that use the abstract Message Transport 538 API provided by RELOAD. The goal of this layer is to implement 539 application-specific usages of the generic overlay services provided 540 by RELOAD. The usage defines how a specific application maps its 541 data into something that can be stored in the overlay, where to store 542 the data, how to secure the data, and finally how applications can 543 retrieve and use the data. 545 The architecture diagram shows both a SIP usage and an XMPP usage. A 546 single application may require multiple usages; for example a SIP 547 application may also require a voicemail usage. A usage may define 548 multiple kinds of data that are stored in the overlay and may also 549 rely on kinds originally defined by other usages. 551 Because the security and storage policies for each kind are dictated 552 by the usage defining the kind, the usages may be coupled with the 553 Storage component to provide security policy enforcement and to 554 implement appropriate storage strategies according to the needs of 555 the usage. The exact implementation of such an interface is outside 556 the scope of this specification. 558 1.2.2. Message Transport 560 The Message Transport component provides a generic message routing 561 service for the overlay. The Message Transport layer is responsible 562 for end-to-end message transactions, including retransmissions. Each 563 peer is identified by its location in the overlay as determined by 564 its Node-ID. A component that is a client of the Message Transport 565 can perform two basic functions: 567 o Send a message to a given peer specified by Node-ID or to the peer 568 responsible for a particular Resource-ID. 569 o Receive messages that other peers send to a Node-ID or Resource-ID 570 for which the receiving peer is responsible. 572 All usages rely on the Message Transport component to send and 573 receive messages from peers. For instance, when a usage wants to 574 store data, it does so by sending Store requests. Note that the 575 Storage component and the Topology Plugin are themselves clients of 576 the Message Transport, because they need to send and receive messages 577 from other peers. 579 The Message Transport API is similar to those described as providing 580 "Key based routing" (KBR), although as RELOAD supports different 581 overlay algorithms (including non-DHT overlay algorithms) that 582 calculate keys in different ways, the actual interface must accept 583 Resource Names rather than actual keys. 585 1.2.3. Storage 587 One of the major functions of RELOAD is to allow nodes to store data 588 in the overlay and to retrieve data stored by other nodes or by 589 themselves. The Storage component is responsible for processing data 590 storage and retrieval messages. For instance, the Storage component 591 might receive a Store request for a given resource from the Message 592 Transport. It would then query the appropriate usage before storing 593 the data value(s) in its local data store and sending a response to 594 the Message Transport for delivery to the requesting node. 595 Typically, these messages will come from other nodes, but depending 596 on the overlay topology, a node might be responsible for storing data 597 for itself as well, especially if the overlay is small. 599 A peer's Node-ID determines the set of resources that it will be 600 responsible for storing. However, the exact mapping between these is 601 determined by the overlay algorithm in use. The Storage component 602 will only receive a Store request from the Message Transport if this 603 peer is responsible for that Resource-ID. The Storage component is 604 notified by the Topology Plugin when the Resource-IDs for which it is 605 responsible change, and the Storage component is then responsible for 606 migrating resources to other peers, as required. 608 1.2.4. Topology Plugin 610 RELOAD is explicitly designed to work with a variety of overlay 611 algorithms. In order to facilitate this, the overlay algorithm 612 implementation is provided by a Topology Plugin so that each overlay 613 can select an appropriate overlay algorithm that relies on the common 614 RELOAD core protocols and code. 616 The Topology Plugin is responsible for maintaining the overlay 617 algorithm Routing Table, which is consulted by the Forwarding and 618 Link Management Layer before routing a message. When connections are 619 made or broken, the Forwarding and Link Management Layer notifies the 620 Topology Plugin, which adjusts the routing table as appropriate. The 621 Topology Plugin will also instruct the Forwarding and Link Management 622 Layer to form new connections as dictated by the requirements of the 623 overlay algorithm Topology. The Topology Plugin issues periodic 624 update requests through Message Transport to maintain and update its 625 Routing Table. 627 As peers enter and leave, resources may be stored on different peers, 628 so the Topology Plugin also keeps track of which peers are 629 responsible for which resources. As peers join and leave, the 630 Topology Plugin instructs the Storage component to issue resource 631 migration requests as appropriate, in order to ensure that other 632 peers have whatever resources they are now responsible for. The 633 Topology Plugin is also responsible for providing for redundant data 634 storage to protect against loss of information in the event of a peer 635 failure and to protect against compromised or subversive peers. 637 1.2.5. Forwarding and Link Management Layer 639 The Forwarding and Link Management Layer is responsible for getting a 640 packet to the next peer, as determined by the Topology Plugin. This 641 Layer establishes and maintains the network connections as required 642 by the Topology Plugin. This layer is also responsible for setting 643 up connections to other peers through NATs and firewalls using ICE, 644 and it can elect to forward traffic using relays for NAT and firewall 645 traversal. 647 This layer provides a fairly generic interface that allows the 648 topology plugin to control the overlay and resource operations and 649 messages. Since each overlay algorithm is defined and functions 650 differently, we generically refer to the table of other peers that 651 the overlay algorithm maintains and uses to route requests 652 (neighbors) as a Routing Table. The Topology Plugin actually owns 653 the Routing Table, and forwarding decisions are made by querying the 654 Topology Plugin for the next hop for a particular Node-ID or 655 Resource-ID. If this node is the destination of the message, the 656 message is delivered to the Message Transport. 658 This layer may also utilize a framing header to encapsulate messages 659 as they are forwarding along each hop. Such a header may be used to 660 aid reliability, congestion control, flow control, etc. Any such 661 header has meaning only in the context of that individual link. 663 The Forwarding and Link Management Layer sits on top of the Overlay 664 Link Layer protocols that carry the actual traffic. This 665 specification defines how to use DTLS and TLS protocols to carry 666 RELOAD messages. 668 1.3. Security 670 RELOAD's security model is based on each node having one or more 671 public key certificates. In general, these certificates will be 672 assigned by a central server which also assigns Node-IDs, although 673 self-signed certificates can be used in closed networks. These 674 credentials can be leveraged to provide communications security for 675 RELOAD messages. RELOAD provides communications security at three 676 levels: 678 Connection Level: Connections between peers are secured with TLS 679 or DTLS. 680 Message Level: Each RELOAD message must be signed. 681 Object Level: Stored objects must be signed by the storing peer. 683 These three levels of security work together to allow peers to verify 684 the origin and correctness of data they receive from other peers, 685 even in the face of malicious activity by other peers in the overlay. 686 RELOAD also provides access control built on top of these 687 communications security features. Because the peer responsible for 688 storing a piece of data can validate the signature on the data being 689 stored, the responsible peer can determine whether a given operation 690 is permitted or not. 692 RELOAD also provides an optional shared secret based admission 693 control feature using shared secrets and TLS-PSK. This mode is 694 typically used when self-signed certificates are being used but would 695 generally not be used when the certificates were all signed by an 696 enrollment server. In order to form a TLS connection to any node in 697 the overlay, a new node needs to know the shared overlay key, thus 698 restricting access to authorized users only. This feature is used 699 together with certificate-based access control, not as a replacement 700 for it. 702 1.4. Structure of This Document 704 The remainder of this document is structured as follows. 706 o Section 2 provides definitions of terms used in this document. 707 o Section 3 provides an overview of the mechanisms used to establish 708 and maintain the overlay. 709 o Section 4 provides an overview of the mechanism RELOAD provides to 710 support other applications. 711 o Section 5 defines the protocol messages that RELOAD uses to 712 establish and maintain the overlay. 713 o Section 6 defines the protocol messages that are used to store and 714 retrieve data using RELOAD. 715 o Section 7 defines the Certificate Store Usage that is fundamental 716 to RELOAD security. 717 o Section 8 defines the TURN Server Usage needed to locate TURN 718 servers for NAT traversal. 719 o Section 9 defines a specific Topology Plugin using Chord. 720 o Section 10 defines the mechanisms that new RELOAD nodes use to 721 join the overlay for the first time. 722 o Section 11 provides an extended example. 724 2. Terminology 726 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 727 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 728 document are to be interpreted as described in RFC 2119 [RFC2119]. 730 We use the terminology and definitions from the Concepts and 731 Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft 732 extensively in this document. Other terms used in this document are 733 defined inline when used and are also defined below for reference. 735 DHT: A distributed hash table. A DHT is an abstract hash table 736 service realized by storing the contents of the hash table across 737 a set of peers. 739 Overlay Algorithm: An overlay algorithm defines the rules for 740 determining which peers in an overlay store a particular piece of 741 data and for determining a topology of interconnections amongst 742 peers in order to find a piece of data. 744 Overlay Instance: A specific overlay algorithm and the collection of 745 peers that are collaborating to provide read and write access to 746 it. There can be any number of overlay instances running in an IP 747 network at a time, and each operates in isolation of the others. 749 Peer: A host that is participating in the overlay. Peers are 750 responsible for holding some portion of the data that has been 751 stored in the overlay and also route messages on behalf of other 752 hosts as required by the Overlay Algorithm. 754 Client: A host that is able to store data in and retrieve data from 755 the overlay but which is not participating in routing or data 756 storage for the overlay. 758 Kind: A kind defined a particular type of data that can be stored in 759 the overlay. Applications define new Kinds to story the data they 760 use. Each Kind is identied iwht a unique IANA assinged intereger 761 called a Kind-ID . 763 Node: We use the term "Node" to refer to a host that may be either a 764 Peer or a Client. Because RELOAD uses the same protocol for both 765 clients and peers, much of the text applies equally to both. 766 Therefore we use "Node" when the text applies to both Clients and 767 Peers and the more specific term (i.e. client or peer) when the 768 text applies only to Clients or only to Peers. 770 Node-ID: A 128-bit value that uniquely identifies a node. Node-IDs 771 0 and 2^128 - 1 are reserved and are invalid Node-IDs. A value of 772 zero is not used in the wire protocol but can be used to indicate 773 an invalid node in implementations and APIs. The Node-ID of 774 2^128-1 is used on the wire protocol as a wildcard. 776 Resource: An object or group of objects associated with a string 777 identifier. See "Resource Name" below. 779 Resource Name: The potentially human readable name by which a 780 resource is identified. In unstructured P2P networks, the 781 resource name is sometimes used directly as a Resource-ID. In 782 structured P2P networks the resource name is typically mapped into 783 a Resource-ID by using the string as the input to hash function. 784 A SIP resource, for example, is often identified by its AOR which 785 is an example of a Resource Name. 787 Resource-ID: A value that identifies some resources and which is 788 used as a key for storing and retrieving the resource. Often this 789 is not human friendly/readable. One way to generate a Resource-ID 790 is by applying a mapping function to some other unique name (e.g., 791 user name or service name) for the resource. The Resource-ID is 792 used by the distributed database algorithm to determine the peer 793 or peers that are responsible for storing the data for the 794 overlay. In structured P2P networks, Resource-IDs are generally 795 fixed length and are formed by hashing the resource name. In 796 unstructured networks, resource names may be used directly as 797 Resource-IDs and may be variable lengths. 799 Connection Table: The set of nodes to which a node is directly 800 connected. This includes nodes with which Attach handshakes have 801 been done but which have not sent any Updates. 803 Routing Table: The set of peers which a node can use to route 804 overlay messages. In general, these peers will all be on the 805 connection table but not vice versa, because some peers will have 806 Attached but not sent updates. Peers may send messages directly 807 to peers that are in the connection table but may only route 808 messages to other peers through peers that are in the routing 809 table. 811 Destination List: A list of IDs through which a message is to be 812 routed. A single Node-ID is a trivial form of destination list. 814 Usage: A usage is an application that wishes to use the overlay for 815 some purpose. Each application wishing to use the overlay defines 816 a set of data kinds that it wishes to use. The SIP usage defines 817 the location data kind. 819 The term "maximum request lifetime" is the maximum time a request 820 will wait for a response; it defaults to 15 seconds. The term 821 "successor replacement hold-down time" is the amount of time to wait 822 before starting replication when a new successor is found; it 823 defaults to 30 seconds. 825 3. Overlay Management Overview 827 The most basic function of RELOAD is as a generic overlay network. 828 Nodes need to be able to join the overlay, form connections to other 829 nodes, and route messages through the overlay to nodes to which they 830 are not directly connected. This section provides an overview of the 831 mechanisms that perform these functions. 833 3.1. Security and Identification 835 Every node in the RELOAD overlay is identified by a Node-ID. The 836 Node-ID is used for three major purposes: 838 o To address the node itself. 839 o To determine its position in the overlay topology when the overlay 840 is structured. 841 o To determine the set of resources for which the node is 842 responsible. 844 Each node has a certificate [RFC5280] containing a Node-ID, which is 845 globally unique. 847 The certificate serves multiple purposes: 849 o It entitles the user to store data at specific locations in the 850 Overlay Instance. Each data kind defines the specific rules for 851 determining which certificates can access each Resource-ID/Kind-ID 852 pair. For instance, some kinds might allow anyone to write at a 853 given location, whereas others might restrict writes to the owner 854 of a single certificate. 855 o It entitles the user to operate a node that has a Node-ID found in 856 the certificate. When the node forms a connection to another 857 peer, it uses this certificate so that a node connecting to it 858 knows it is connected to the correct node (technically: a (D)TLS 859 association with client authentication is formed.) In addition, 860 the node can sign messages, thus providing integrity and 861 authentication for messages which are sent from the node. 862 o It entitles the user to use the user name found in the 863 certificate. 865 If a user has more than one device, typically they would get one 866 certificate for each device. This allows each device to act as a 867 separate peer. 869 RELOAD supports multiple certificate issuance models. The first is 870 based on a central enrollment process which allocates a unique name 871 and Node-ID and puts them in a certificate for the user. All peers 872 in a particular Overlay Instance have the enrollment server as a 873 trust anchor and so can verify any other peer's certificate. 875 In some settings, a group of users want to set up an overlay network 876 but are not concerned about attack by other users in the network. 877 For instance, users on a LAN might want to set up a short term ad hoc 878 network without going to the trouble of setting up an enrollment 879 server. RELOAD supports the use of self-generated and self-signed 880 certificates. When self-signed certificates are used, the node also 881 generates its own Node-ID and username. The Node-ID is computed as a 882 digest of the public key, to prevent Node-ID theft; however this 883 model is still subject to a number of known attacks (most notably 884 Sybil attacks [Sybil]) and can only be safely used in closed networks 885 where users are mutually trusting. 887 The general principle here is that the security mechanisms (TLS and 888 message signatures) are always used, even if the certificates are 889 self-signed. This allows for a single set of code paths in the 890 systems with the only difference being whether certificate 891 verification is required to chain to a single root of trust. 893 3.1.1. Shared-Key Security 895 RELOAD also provides an admission control system based on shared 896 keys. In this model, the peers all share a single key which is used 897 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 899 3.2. Clients 901 RELOAD defines a single protocol that is used both as the peer 902 protocol and as the client protocol for the overlay. This simplifies 903 implementation, particularly for devices that may act in either role, 904 and allows clients to inject messages directly into the overlay. 906 We use the term "peer" to identify a node in the overlay that routes 907 messages for nodes other than those to which it is directly 908 connected. Peers typically also have storage responsibilities. We 909 use the term "client" to refer to nodes that do not have routing or 910 storage responsibilities. When text applies to both peers and 911 clients, we will simply refer such devices as "nodes." 913 RELOAD's client support allows nodes that are not participating in 914 the overlay as peers to utilize the same implementation and to 915 benefit from the same security mechanisms as the peers. Clients 916 possess and use certificates that authorize the user to store data at 917 certain locations in the overlay. The Node-ID in the certificate is 918 used to identify the particular client as a member of the overlay and 919 to authenticate its messages. 921 In RELOAD, unlike some other designs, clients are not a first-class 922 concept. From the perspective of a peer, a client is simply a node 923 which has not yet sent any Updates or Joins. It might never do so 924 (if it's a client) or it might eventually do so (if it's just a node 925 that's taking a long time to join). The routing and storage rules 926 for RELOAD provide for correct behavior by peers regardless of 927 whether other nodes attached to them are clients or peers. Of 928 course, a client implementation must know that it intends to be a 929 client, but this localizes complexity only to that node. 931 For more discussion of the motivation for RELOAD's client support, 932 see Appendix C. 934 3.2.1. Client Routing 936 There are two routing options by which a client may be located in an 937 overlay. 939 o Establish a connection to the peer responsible for the client's 940 Node-ID in the overlay. Then requests may be sent from/to the 941 client using its Node-ID in the same manner as if it were a peer, 942 because the responsible peer in the overlay will handle the final 943 step of routing to the client. This may require a TURN relay in 944 cases where NATs or firewalls prevent a client from forming a 945 direct connections with its responsible peer. Note that clients 946 that choose this option MUST process Update messages from the 947 peer. Those updates can indicate that the peer no longer owns the 948 Client's Node-ID. The client then forms a connection to the 949 appropriate peer. Failure to do so will result in the client no 950 longer receiving messages. 951 o Establish a connection with an arbitrary peer in the overlay 952 (perhaps based on network proximity or an inability to establish a 953 direct connection with the responsible peer). In this case, the 954 client will rely on RELOAD's Destination List feature to ensure 955 reachability. The client can initiate requests, and any node in 956 the overlay that knows the Destination List to its current 957 location can reach it, but the client is not directly reachable 958 using only its Node-ID. The Destination List required to reach it 959 must be learnable via other mechanisms, such as being stored in 960 the overlay by a usage, if the client is to receive incoming 961 requests from other members of the overlay. 963 3.2.2. Minimum Functionality Requirements for Clients 965 A node may act as a client simply because it does not have the 966 resources or even an implementation of the topology plugin required 967 to act as a peer in the overlay. In order to exchange RELOAD 968 messages with a peer, a client must meet a minimum level of 969 functionality. Such a client must: 971 o Implement RELOAD's connection-management operations that are used 972 to establish the connection with the peer. 973 o Implement RELOAD's data retrieval methods (with client 974 functionality). 975 o Be able to calculate Resource-IDs used by the overlay. 976 o Possess security credentials required by the overlay it is 977 implementing. 979 A client speaks the same protocol as the peers, knows how to 980 calculate Resource-IDs, and signs its requests in the same manner as 981 peers. While a client does not necessarily require a full 982 implementation of the overlay algorithm, calculating the Resource-ID 983 requires an implementation of the appropriate algorithm for the 984 overlay. 986 3.3. Routing 988 This section will discuss the requirements RELOAD's routing 989 capabilities must meet, then describe the routing features in the 990 protocol, and then provide a brief overview of how they are used. 991 Appendix B discusses some alternative designs and the tradeoffs that 992 would be necessary to support them. 994 RELOAD's routing capabilities must meet the following requirements: 996 NAT Traversal: RELOAD must support establishing and using 997 connections between nodes separated by one or more NATs, including 998 locating peers behind NATs for those overlays allowing/requiring 999 it. 1000 Clients: RELOAD must support requests from and to clients that do 1001 not participate in overlay routing. 1002 Client promotion: RELOAD must support clients that become peers at a 1003 later point as determined by the overlay algorithm and deployment. 1004 Low state: RELOAD's routing algorithms must not require 1005 significant state to be stored on intermediate peers. 1006 Return routability in unstable topologies: At some points in 1007 times, different nodes may have inconsistent information about the 1008 connectivity of the routing graph. In all cases, the response to 1009 a request needs to delivered to the node that sent the request and 1010 not to some other node. 1012 To meet these requirements, RELOAD's routing relies on two basic 1013 mechanisms: 1015 Via Lists: The forwarding header used by all RELOAD messages 1016 contains both a Via List (built hop-by-hop as the message is 1017 routed through the overlay) and a Destination List (providing 1018 source-routing capabilities for requests and return-path routing 1019 for responses). 1020 Route_Query: The Route_Query method allows a node to query a peer 1021 for the next hop it will use to route a message. This method is 1022 useful for diagnostics and for iterative routing. 1024 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1025 We will first describe symmetric routing and then discuss its 1026 advantages in terms of the requirements discussed above. 1028 Symmetric recursive routing requires that a message follow the path 1029 through the overlay to the destination without returning to the 1030 originating node: each peer forwards the message closer to its 1031 destination. The return path of the response is then the same path 1032 followed in reverse. For example, a message following a route from A 1033 to Z through B and X: 1035 A B X Z 1036 ------------------------------- 1038 ----------> 1039 Dest=Z 1040 ----------> 1041 Via=A 1042 Dest=Z 1043 ----------> 1044 Via=A, B 1045 Dest=Z 1047 <---------- 1048 Dest=X, B, A 1049 <---------- 1050 Dest=B, A 1051 <---------- 1052 Dest=A 1054 Note that the preceding Figure does not indicate whether A is a 1055 client or peer: A forwards its request to B and the response is 1056 returned to A in the same manner regardless of A's role in the 1057 overlay. 1059 This figure shows use of full via-lists by intermediate peers B and 1060 X. However, if B and/or X are willing to store state, then they may 1061 elect to truncate the lists, save that information internally (keyed 1062 by the transaction id), and return the response message along the 1063 path from which it was received when the response is received. This 1064 option requires greater state to be stored on intermediate peers but 1065 saves a small amount of bandwidth and reduces the need for modifying 1066 the message en route. Selection of this mode of operation is a 1067 choice for the individual peer; the techniques are interoperable even 1068 on a single message. The figure below shows B using full via lists 1069 but X truncating them and saving the state internally. 1071 A B X Z 1072 ------------------------------- 1074 ----------> 1075 Dest=Z 1076 ----------> 1077 Via=A 1078 Dest=Z 1079 ----------> 1080 Dest=Z 1082 <---------- 1083 Dest=X 1084 <---------- 1085 Dest=B, A 1086 <---------- 1087 Dest=A 1089 RELOAD also supports a basic Iterative routing mode (where the 1090 intermediate peers merely return a response indicating the next hop, 1091 but do not actually forward the message to that next hop themselves). 1092 Iterative routing is implemented using the Route_Query method, which 1093 requests this behavior. Note that iterative routing is selected only 1094 by the initiating node. 1096 3.4. Connectivity Management 1098 In order to provide efficient routing, a peer needs to maintain a set 1099 of direct connections to other peers in the Overlay Instance. Due to 1100 the presence of NATs, these connections often cannot be formed 1101 directly. Instead, we use the Attach request to establish a 1102 connection. Attach uses ICE [I-D.ietf-mmusic-ice] to establish the 1103 connection. It is assumed that the reader is familiar with ICE. 1105 Say that peer A wishes to form a direct connection to peer B. It 1106 gathers ICE candidates and packages them up in an Attach request 1107 which it sends to B through usual overlay routing procedures. B does 1108 its own candidate gathering and sends back a response with its 1109 candidates. A and B then do ICE connectivity checks on the candidate 1110 pairs. The result is a connection between A and B. At this point, A 1111 and B can add each other to their routing tables and send messages 1112 directly between themselves without going through other overlay 1113 peers. 1115 There is one special case in which Attach cannot be used: when a 1116 peer is joining the overlay and is not connected to any peers. In 1117 order to support this case, some small number of "bootstrap nodes" 1118 typically need to be publicly accessible so that new peers can 1119 directly connect to them. Section 10 contains more detail on this. 1121 In general, a peer needs to maintain connections to all of the peers 1122 near it in the Overlay Instance and to enough other peers to have 1123 efficient routing (the details depend on the specific overlay). If a 1124 peer cannot form a connection to some other peer, this isn't 1125 necessarily a disaster; overlays can route correctly even without 1126 fully connected links. However, a peer should try to maintain the 1127 specified link set and if it detects that it has fewer direct 1128 connections, should form more as required. This also implies that 1129 peers need to periodically verify that the connected peers are still 1130 alive and if not try to reform the connection or form an alternate 1131 one. 1133 3.5. Overlay Algorithm Support 1135 The Topology Plugin allows RELOAD to support a variety of overlay 1136 algorithms. This specification defines a DHT based on Chord [Chord], 1137 which is mandatory to implement, but the base RELOAD protocol is 1138 designed to support a variety of overlay algorithms. 1140 3.5.1. Support for Pluggable Overlay Algorithms 1142 RELOAD defines three methods for overlay maintenance: Join, Update, 1143 and Leave. However, the contents of those messages, when they are 1144 sent, and their precise semantics are specified by the actual overlay 1145 algorithm; RELOAD merely provides a framework of commonly-needed 1146 methods that provides uniformity of notation (and ease of debugging) 1147 for a variety of overlay algorithms. 1149 3.5.2. Joining, Leaving, and Maintenance Overview 1151 When a new peer wishes to join the Overlay Instance, it must have a 1152 Node-ID that it is allowed to use. When an enrollment server is used 1153 that Node-ID will be in the certificate the node received from the 1154 enrollment server. The details of the joining procedure are defined 1155 by the overlay algorithm, but the general steps for joining an 1156 Overlay Instance are: 1158 o Forming connections to some other peers. 1159 o Acquiring the data values this peer is responsible for storing. 1160 o Informing the other peers which were previously responsible for 1161 that data that this peer has taken over responsibility. 1163 The first thing the peer needs to do is to form a connection to some 1164 "bootstrap node". Because this is the first connection the peer 1165 makes, these nodes must have public IP addresses so that they can be 1166 connected to directly. Once a peer has connected to one or more 1167 bootstrap nodes, it can form connections in the usual way by routing 1168 Attach messages through the overlay to other nodes. Once a peer has 1169 connected to the overlay for the first time, it can cache the set of 1170 nodes it has connected to with public IP addresses for use as future 1171 bootstrap nodes. 1173 Once a peer has connected to a bootstrap node, it then needs to take 1174 up its appropriate place in the overlay. This requires two major 1175 operations: 1177 o Forming connections to other peers in the overlay to populate its 1178 Routing Table. 1179 o Getting a copy of the data it is now responsible for storing and 1180 assuming responsibility for that data. 1182 The second operation is performed by contacting the Admitting Peer 1183 (AP), the node which is currently responsible for that section of the 1184 overlay. 1186 The details of this operation depend mostly on the overlay algorithm 1187 involved, but a typical case would be: 1189 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1190 announcing its intention to join. 1191 2. AP sends a Join response. 1192 3. AP does a sequence of Stores to JP to give it the data it will 1193 need. 1194 4. AP does Updates to JP and to other peers to tell it about its own 1195 routing table. At this point, both JP and AP consider JP 1196 responsible for some section of the Overlay Instance. 1197 5. JP makes its own connections to the appropriate peers in the 1198 Overlay Instance. 1200 After this process is completed, JP is a full member of the Overlay 1201 Instance and can process Store/Fetch requests. 1203 Note that the first node is a special case. When ordinary nodes 1204 cannot form connections to the bootstrap nodes, then they are not 1205 part of the overlay. However, the first node in the overlay can 1206 obviously not connect to others nodes. In order to support this 1207 case, potential first nodes (which must also serve as bootstrap nodes 1208 initially) must somehow be instructed (perhaps by configuration 1209 settings) that they are the entire overlay, rather than not part of 1210 it. 1212 Note that clients do not perfom either of these operations. 1214 3.6. First-Time Setup 1216 Previous sections addressed how RELOAD works once a node has 1217 connected. This section provides an overview of how users get 1218 connected to the overlay for the first time. RELOAD is designed so 1219 that users can start with the name of the overlay they wish to join 1220 and perhaps a username and password, and leverage that into having a 1221 working peer with minimal user intervention. This helps avoid the 1222 problems that have been experienced with conventional SIP clients 1223 where users are required to manually configure a large number of 1224 settings. 1226 3.6.1. Initial Configuration 1228 In the first phase of the process, the user starts out with the name 1229 of the overlay and uses this to download an initial set of overlay 1230 configuration parameters. The node does a DNS SRV lookup on the 1231 overlay name to get the address of a configuration server. It can 1232 then connect to this server with HTTPS to download a configuration 1233 document which contains the basic overlay configuration parameters as 1234 well as a set of bootstrap nodes which can be used to join the 1235 overlay. 1237 If a node already has the valid configuration document that it 1238 received by some out of band method, this step can be skipped. 1240 3.6.2. Enrollment 1242 If the overlay is using centralized enrollment, then a user needs to 1243 acquire a certificate before joining the overlay. The certificate 1244 attests both to the user's name within the overlay and to the Node- 1245 IDs which they are permitted to operate. In that case, the 1246 configuration document will contain the address of an enrollment 1247 server which can be used to obtain such a certificate. The 1248 enrollment server may (and probably will) require some sort of 1249 username and password before issuing the certificate. The enrollment 1250 server's ability to restrict attackers' access to certificates in the 1251 overlay is one of the cornerstones of RELOAD's security. 1253 4. Application Support Overview 1255 RELOAD is not intended to be used alone, but rather as a substrate 1256 for other applications. These applications can use RELOAD for a 1257 variety of purposes: 1259 o To store data in the overlay and retrieve data stored by other 1260 nodes. 1261 o As a discovery mechanism for services such as TURN. 1262 o To form direct connections which can be used to transmit 1263 application-level messages. 1265 This section provides an overview of these services. 1267 4.1. Data Storage 1269 RELOAD provides operations to Store and Fetch data. Each location in 1270 the Overlay Instance is referenced by a Resource-ID. However, each 1271 location may contain data elements corresponding to multiple kinds 1272 (e.g., certificate, SIP registration). Similarly, there may be 1273 multiple elements of a given kind, as shown below: 1275 +--------------------------------+ 1276 | Resource-ID | 1277 | | 1278 | +------------+ +------------+ | 1279 | | Kind 1 | | Kind 2 | | 1280 | | | | | | 1281 | | +--------+ | | +--------+ | | 1282 | | | Value | | | | Value | | | 1283 | | +--------+ | | +--------+ | | 1284 | | | | | | 1285 | | +--------+ | | +--------+ | | 1286 | | | Value | | | | Value | | | 1287 | | +--------+ | | +--------+ | | 1288 | | | +------------+ | 1289 | | +--------+ | | 1290 | | | Value | | | 1291 | | +--------+ | | 1292 | +------------+ | 1293 +--------------------------------+ 1295 Each kind is identified by a Kind-ID, which is a code point assigned 1296 by IANA. As part of the kind definition, protocol designers may 1297 define constraints, such as limits on size, on the values which may 1298 be stored. For many kinds, the set may be restricted to a single 1299 value; some sets may be allowed to contain multiple identical items 1300 while others may only have unique items. Note that a kind may be 1301 employed by multiple usages and new usages are encouraged to use 1302 previously defined kinds where possible. We define the following 1303 data models in this document, though other usages can define their 1304 own structures: 1306 single value: There can be at most one item in the set and any value 1307 overwrites the previous item. 1309 array: Many values can be stored and addressed by a numeric index. 1311 dictionary: The values stored are indexed by a key. Often this key 1312 is one of the values from the certificate of the peer sending the 1313 Store request. 1315 In order to protect stored data from tampering, by other nodes, each 1316 stored value is digitally signed by the node which created it. When 1317 a value is retrieved, the digital signature can be verified to detect 1318 tampering. 1320 4.1.1. Storage Permissions 1322 A major issue in peer-to-peer storage networks is minimizing the 1323 burden of becoming a peer, and in particular minimizing the amount of 1324 data which any peer is required to store for other nodes. RELOAD 1325 addresses this issue by only allowing any given node to store data at 1326 a small number of locations in the overlay, with those locations 1327 being determined by the node's certificate. When a peer uses a Store 1328 request to place data at a location authorized by its certificate, it 1329 signs that data with the private key that corresponds to its 1330 certificate. Then the peer responsible for storing the data is able 1331 to verify that the peer issuing the request is authorized to make 1332 that request. Each data kind defines the exact rules for determining 1333 what certificate is appropriate. 1335 The most natural rule is that a certificate authorizes a user to 1336 store data keyed with their user name X. This rule is used for all 1337 the kinds defined in this specification. Thus, only a user with a 1338 certificate for "alice@example.org" could write to that location in 1339 the overlay. However, other usages can define any rules they choose, 1340 including publicly writable values. 1342 The digital signature over the data serves two purposes. First, it 1343 allows the peer responsible for storing the data to verify that this 1344 Store is authorized. Second, it provides integrity for the data. 1345 The signature is saved along with the data value (or values) so that 1346 any reader can verify the integrity of the data. Of course, the 1347 responsible peer can "lose" the value but it cannot undetectably 1348 modify it. 1350 The size requirements of the data being stored in the overlay are 1351 variable. For instance, a SIP AoR and voicemail differ widely in the 1352 storage size. RELOAD leaves it to the Usage and overlay 1353 configuration to limit size imbalance of various kinds. 1355 4.1.2. Usages 1357 By itself, the distributed storage layer just provides infrastructure 1358 on which applications are built. In order to do anything useful, a 1359 usage must be defined. Each Usage specifies several things: 1361 o Registers Kind-ID code points for any kinds that the Usage 1362 defines. 1363 o Defines the data structure for each of the kinds. 1364 o Defines access control rules for each of the kinds. 1365 o Defines how the Resource Name is formed that is hashed to form the 1366 Resource-ID where each kind is stored. 1367 o Describes how values will be merged after a network partition. 1368 Unless otherwise specified, the default merging rule is to act as 1369 if all the values that need to be merged were stored and as if the 1370 order they were stored in corresponds to the stored time values 1371 associated with (and carried in) their values. Because the stored 1372 time values are those associated with the peer which did the 1373 writing, clock skew is generally not an issue. If two nodes are 1374 on different partitions, write to the same location, and have 1375 clock skew, this can create merge conflicts. However because 1376 RELOAD deliberately segregates storage so that data from different 1377 users and peers is stored in different locations, and a single 1378 peer will typically only be in a single network partition, this 1379 case will generally not arise. 1380 o Defines the types of connections that can be initiated using 1381 AppAttach. 1383 The kinds defined by a usage may also be applied to other usages. 1384 However, a need for different parameters, such as different size 1385 limits, would imply the need to create a new kind. 1387 4.1.3. Replication 1389 Replication in P2P overlays can be used to provide: 1391 persistence: if the responsible peer crashes and/or if the storing 1392 peer leaves the overlay 1394 security: to guard against DoS attacks by the responsible peer or 1395 routing attacks to that responsible peer 1396 load balancing: to balance the load of queries for popular 1397 resources. 1399 A variety of schemes are used in P2P overlays to achieve some of 1400 these goals. Common techniques include replicating on neighbors of 1401 the responsible peer, randomly locating replicas around the overlay, 1402 or replicating along the path to the responsible peer. 1404 The core RELOAD specification does not specify a particular 1405 replication strategy. Instead, the first level of replication 1406 strategies are determined by the overlay algorithm, which can base 1407 the replication strategy on its particular topology. For example, 1408 Chord places replicas on successor peers, which will take over 1409 responsibility should the responsible peer fail [Chord]. 1411 If additional replication is needed, for example if data persistence 1412 is particularly important for a particular usage, then that usage may 1413 specify additional replication, such as implementing random 1414 replications by inserting a different well known constant into the 1415 Resource Name used to store each replicated copy of the resource. 1416 Such replication strategies can be added independent of the 1417 underlying algorithm, and their usage can be determined based on the 1418 needs of the particular usage. 1420 4.2. Service Discovery 1422 RELOAD does not currently define a generic service discovery 1423 algorithm as part of the base protocol, although a simplistic TURN- 1424 specific discovery mechanism is provided. A variety of service 1425 discovery algorithms can be implemented as extensions to the base 1426 protocol, such as the service discovery algorithm ReDIR 1427 [opendht-sigcomm05] . 1429 4.3. Application Connectivity 1431 There is no requirement that a RELOAD usage must use RELOAD's 1432 primitives for establishing its own communication if it already 1433 possesses its own means of establishing connections. For example, 1434 one could design a RELOAD-based resource discovery protocol which 1435 used HTTP to retrieve the actual data. 1437 For more common situations, however, it is the overlay itself - 1438 rather than an external authority such as DNS - which is used to 1439 establish a connection. RELOAD provides connectivity to applications 1440 using the AppAttach method. For example, if a P2PSIP node wishes to 1441 establish a SIP dialog with another P2PSIP node, it will use 1442 AppAttach to establish a direct connection with the other node. This 1443 new connection is separate from the peer protocol connection. It is 1444 a dedicated UDP or TCP flow used only for the SIP dialog. Each usage 1445 specifies which types of connections can be initiated using 1446 AppAttach. 1448 5. Overlay Management Protocol 1450 This section defines the basic protocols used to create, maintain, 1451 and use the RELOAD overlay network. We start by defining the basic 1452 concept of how message destinations are interpreted when routing 1453 messages. We then describe the symmetric recursive routing model, 1454 which is RELOAD's default routing algorithm. We then define the 1455 message structure and then finally define the messages used to join 1456 and maintain the overlay. 1458 5.1. Message Receipt and Forwarding 1460 When a peer receives a message, it first examines the overlay, 1461 version, and other header fields to determine whether the message is 1462 one it can process. If any of these are incorrect (e.g., the message 1463 is for an overlay in which the peer does not participate) it is an 1464 error. The peer SHOULD generate an appropriate error but local 1465 policy can override this and cause the messages to be silently 1466 dropped. 1468 Once the peer has determined that the message is correctly formatted, 1469 it examines the first entry on the destination list. There are three 1470 possible cases here: 1472 o The first entry on the destination list is an ID for which the 1473 peer is responsible. 1474 o The first entry on the destination list is an ID for which another 1475 peer is responsible. 1476 o The first entry on the destination list is a private ID that is 1477 being used for destination list compression. This is described 1478 later. 1480 These cases are handled as discussed below. 1482 5.1.1. Responsible ID 1484 If the first entry on the destination list is an ID for which the 1485 node is responsible, there are several sub-cases. 1486 o If the entry is a Resource-ID, then it MUST be the only entry on 1487 the destination list. If there are other entries, the message 1488 MUST be silently dropped. Otherwise, the message is destined for 1489 this node and it passes it up to the upper layers. 1490 o If the entry is a Node-ID which equals this node's Node-ID, then 1491 the message is destined for this node. If this is the only entry 1492 on the destination list, the message is destined for this node and 1493 is passed up to the upper layers. Otherwise the entry is removed 1494 from the destination list and the message is passed to the Message 1495 Transport. If the message is a response and there is state for 1496 the transaction ID, the state is reinserted into the destination 1497 list first. 1498 o If the entry is a Node-ID which is not equal to this node, then 1499 the node MUST drop the message silently unless the Node-ID 1500 corresponds to a node which is directly connected to this node 1501 (i.e., a client). In that case, it MUST forward the message to 1502 the destination node as described in the next section. 1504 Note that this implies that in order to address a message to "the 1505 peer that controls region X", a sender sends to Resource-ID X, not 1506 Node-ID X. 1508 5.1.2. Other ID 1510 If neither of the other three cases applies, then the peer MUST 1511 forward the message towards the first entry on the destination list. 1512 This means that it MUST select one of the peers to which it is 1513 connected and which is likely to be responsible for the first entry 1514 on the destination list. If the first entry on the destination list 1515 is in the peer's connection table, then it SHOULD forward the message 1516 to that peer directly. Otherwise, the peer consults the routing 1517 table to forward the message. 1519 Any intermediate peer which forwards a RELOAD message MUST arrange 1520 that if it receives a response to that message the response can be 1521 routed back through the set of nodes through which the request 1522 passed. This may be arranged in one of two ways: 1524 o The peer MAY add an entry to the via list in the forwarding header 1525 that will enable it to determine the correct node. 1526 o The peer MAY keep per-transaction state which will allow it to 1527 determine the correct node. 1529 As an example of the first strategy, if node D receives a message 1530 from node C with via list (A, B), then D would forward to the next 1531 node (E) with via list (A, B, C). Now, if E wants to respond to the 1532 message, it reverses the via list to produce the destination list, 1533 resulting in (D, C, B, A). When D forwards the response to C, the 1534 destination list will contain (C, B, A). 1536 As an example of the second strategy, if node D receives a message 1537 from node C with transaction ID X and via list (A, B), it could store 1538 (X, C) in its state database and forward the message with the via 1539 list unchanged. When D receives the response, it consults its state 1540 database for transaction id X, determines that the request came from 1541 C, and forwards the response to C. 1543 Intermediate peers which modify the via list are not required to 1544 simply add entries. The only requirement is that the peer be able to 1545 reconstruct the correct destination list on the return route. RELOAD 1546 provides explicit support for this functionality in the form of 1547 private IDs, which can replace any number of via list entries. For 1548 instance, in the above example, Node D might send E a via list 1549 containing only the private ID (I). E would then use the destination 1550 list (D, I) to send its return message. When D processes this 1551 destination list, it would detect that I is a private ID, recover the 1552 via list (A, B, C), and reverse that to produce the correct 1553 destination list (C, B, A) before sending it to C. This feature is 1554 called List Compression. I MAY either be a compressed version of the 1555 original via list or an index into a state database containing the 1556 original via list. 1558 Note that if an intermediate peer exits the overlay, then on the 1559 return trip the message cannot be forwarded and will be dropped. The 1560 ordinary timeout and retransmission mechanisms provide stability over 1561 this type of failure. 1563 5.1.3. Private ID 1565 If the first entry in the destination list is a private id (e.g., a 1566 compressed via list), the peer MUST replace that entry with the 1567 original via list that it replaced and then re-examine the 1568 destination list to determine which of the above cases now applies. 1570 5.2. Symmetric Recursive Routing 1572 This Section defines RELOAD's symmetric recursive routing algorithm, 1573 which is the default algorithm used by nodes to route messages 1574 through the overlay. All implementations MUST implement this routing 1575 algorithm. An overlay may be configured to use alternative routing 1576 algorithms, and alternative routing algorithms may be selected on a 1577 per-message basis. 1579 5.2.1. Request Origination 1581 In order to originate a message to a given Node-ID or Resource-ID, a 1582 node constructs an appropriate destination list. The simplest such 1583 destination list is a single entry containing the Node-ID or 1584 Resource-ID. The resulting message will use the normal overlay 1585 routing mechanisms to forward the message to that destination. The 1586 node can also construct a more complicated destination list for 1587 source routing. 1589 Once the message is constructed, the node sends the message to some 1590 adjacent peer. If the first entry on the destination list is 1591 directly connected, then the message MUST be routed down that 1592 connection. Otherwise, the topology plugin MUST be consulted to 1593 determine the appropriate next hop. 1595 Parallel searches for the resource are a common solution to improve 1596 reliability in the face of churn or of subversive peers. Parallel 1597 searches for usage-specified replicas are managed by the usage layer. 1598 However, a single request can also be routed through multiple 1599 adjacent peers, even when known to be sub-optimal, to improve 1600 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1601 specified by the topology plugin. 1603 Because messages may be lost in transit through the overlay, RELOAD 1604 incorporates an end-to-end reliability mechanism. When an 1605 originating node transmits a request it MUST set a 3 second timer. 1606 If a response has not been received when the timer fires, the request 1607 is retransmitted with the same transaction identifier. The request 1608 MAY be retransmitted up to 4 times (for a total of 5 messages). 1609 After the timer for the fifth transmission fires, the message SHALL 1610 be considered to have failed. Note that this retransmission 1611 procedure is not followed by intermediate nodes. They follow the 1612 hop-by-hop reliability procedure described in Section 5.6.3. 1614 The above algorithm can result in multiple requests being delivered 1615 to a node. Receiving nodes MUST generate semantically equivalent 1616 responses to retransmissions of the same request (this can be 1617 determined by transaction id) if the request is received within the 1618 maximum request lifetime (15 seconds). For some requests (e.g., 1619 Fetch) this can be accomplished merely by processing the request 1620 again. For other requests, (e.g., Store) it may be necessary to 1621 maintain state for the duration of the request lifetime. 1623 5.2.2. Response Origination 1625 When a peer sends a response to a request using this routing 1626 algorithm, it MUST construct the destination list by reversing the 1627 order of the entries on the via list. This has the result that the 1628 response traverses the same peers as the request traversed, except in 1629 reverse order (symmetric routing). 1631 5.3. Message Structure 1633 RELOAD is a message-oriented request/response protocol. The messages 1634 are encoded using binary fields. All integers are represented in 1635 network byte order. The general philosophy behind the design was to 1636 use Type, Length, Value fields to allow for extensibility. However, 1637 for the parts of a structure that were required in all messages, we 1638 just define these in a fixed position, as adding a type and length 1639 for them is unnecessary and would simply increase bandwidth and 1640 introduces new potential for interoperability issues. 1642 Each message has three parts, concatenated as shown below: 1644 +-------------------------+ 1645 | Forwarding Header | 1646 +-------------------------+ 1647 | Message Contents | 1648 +-------------------------+ 1649 | Security Block | 1650 +-------------------------+ 1652 The contents of these parts are as follows: 1654 Forwarding Header: Each message has a generic header which is used 1655 to forward the message between peers and to its final destination. 1656 This header is the only information that an intermediate peer 1657 (i.e., one that is not the target of a message) needs to examine. 1659 Message Contents: The message being delivered between the peers. 1660 From the perspective of the forwarding layer, the contents are 1661 opaque, however, they are interpreted by the higher layers. 1663 Security Block: A security block containing certificates and a 1664 digital signature over the message. Note that this signature can 1665 be computed without parsing the message contents. All messages 1666 MUST be signed by their originator. 1668 The following sections describe the format of each part of the 1669 message. 1671 5.3.1. Presentation Language 1673 The structures defined in this document are defined using a C-like 1674 syntax based on the presentation language used to define TLS. 1675 Advantages of this style include: 1677 o It is easy to write and familiar enough looking that most readers 1678 can grasp it quickly. 1679 o The ability to define nested structures allows a separation 1680 between high-level and low-level message structures. 1681 o It has a straightforward wire encoding that allows quick 1682 implementation, but the structures can be comprehended without 1683 knowing the encoding. 1684 o The ability to mechanically compile encoders and decoders. 1686 Several idiosyncrasies of this language are worth noting. 1688 o All lengths are denoted in bytes, not objects. 1689 o Variable length values are denoted like arrays with angle 1690 brackets. 1691 o "select" is used to indicate variant structures. 1693 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1694 but only up to 127 values of two bytes (16 bits) each. 1696 5.3.1.1. Common Definitions 1698 The following definitions are used throughout RELOAD and so are 1699 defined here. They also provide a convenient introduction to how to 1700 read the presentation language. 1702 An enum represents an enumerated type. The values associated with 1703 each possibility are represented in parentheses and the maximum value 1704 is represented as a nameless value, for purposes of describing the 1705 width of the containing integral type. For instance, Boolean 1706 represents a true or false: 1708 enum { false (0), true(1), (255)} Boolean; 1710 A boolean value is either a 1 or a 0 and is represented as a single 1711 byte on the wire. 1713 The NodeId, shown below, represents a single Node-ID. 1715 typedef opaque NodeId[16]; 1717 A NodeId is a fixed-length 128-bit structure represented as a series 1718 of bytes, with the most significant byte first. Note: the use of 1719 "typedef" here is an extension to the TLS language, but its meaning 1720 should be relatively obvious. 1722 A ResourceId, shown below, represents a single Resource-ID. 1724 typedef opaque ResourceId<0..2^8-1>; 1726 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1727 NodeIds, ResourceIds are variable length, up to 255 bytes (2048 bits) 1728 in length. On the wire, each ResourceId is preceded by a single 1729 length byte (allowing lengths up to 255). Thus, the 3-byte value 1730 "FOO" would be encoded as: 03 46 4f 4f. 1732 A more complicated example is IpAddressPort, which represents a 1733 network address and can be used to carry either an IPv6 or IPv4 1734 address: 1736 enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 1737 (255)} AddressType; 1739 struct { 1740 uint32 addr; 1741 uint16 port; 1742 } IPv4AddrPort; 1744 struct { 1745 uint128 addr; 1746 uint16 port; 1747 } IPv6AddrPort; 1749 struct { 1750 AddressType type; 1751 uint8 length; 1753 select (type) { 1754 case ipv4_address: 1755 IPv4AddrPort v4addr_port; 1757 case ipv6_address: 1758 IPv6AddrPort v6addr_port; 1760 /* This structure can be extended */ 1762 } IpAddressPort; 1764 The first two fields in the structure are the same no matter what 1765 kind of address is being represented: 1767 type: the type of address (v4 or v6). 1768 length: the length of the rest of the structure. 1770 By having the type and the length appear at the beginning of the 1771 structure regardless of the kind of address being represented, an 1772 implementation which does not understand new address type X can still 1773 parse the IpAddressPort field and then discard it if it is not 1774 needed. 1776 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1777 an IPv6AddrPort. Both of these simply consist of an address 1778 represented as an integer and a 16-bit port. As an example, here is 1779 the wire representation of the IPv4 address "192.0.2.1" with port 1780 "6100". 1782 01 ; type = IPv4 1783 06 ; length = 6 1784 c0 00 02 01 ; address = 192.0.2.1 1785 17 d4 ; port = 6100 1787 Unless a given structure that uses a select explicitly allows for 1788 unknown types in the select, any unknown type SHOULD be treated as an 1789 parsing error and the whole message discarded with no response. 1791 5.3.2. Forwarding Header 1793 The forwarding header is defined as a ForwardingHeader structure, as 1794 shown below. 1796 struct { 1797 uint32 relo_token; 1798 uint32 overlay; 1799 uint16 configuration_sequence; 1800 uint8 version; 1801 uint8 ttl; 1802 uint32 fragment; 1803 uint32 length; 1804 uint64 transaction_id; 1805 uint32 max_response_length; 1806 uint16 via_list_length; 1807 uint16 destination_list_length; 1808 uint16 options_length; 1809 Destination via_list[via_list_length]; 1810 Destination destination_list 1811 [destination_list_length]; 1813 ForwardingOptions options[options_length]; 1814 } ForwardingHeader; 1816 The contents of the structure are: 1818 relo_token: The first four bytes identify this message as a RELOAD 1819 message. The message is easy to demultiplex from STUN messages by 1820 looking at the first bit. This field MUST contain the value 1821 0xc2454c4f (the string 'RELO' with the high bit of the first byte 1822 set.). 1824 overlay: The 32 bit checksum/hash of the overlay being used. The 1825 variable length string representing the overlay name is hashed 1826 with SHA-1 and the low order 32 bits are used. The purpose of 1827 this field is to allow nodes to participate in multiple overlays 1828 and to detect accidental misconfiguration. This is not a security 1829 critical function. 1831 configuration_sequence: The sequence number of the configuration 1832 file. 1834 version: The version of the RELOAD protocol being used. This is a 1835 fixed point interger between 0.1 and 25.4. This document 1836 describes version 0.1, with a value of 0x01. [[ Note to RFC 1837 Editor: Please update this to version 1.0 with value of 0x0a and 1838 remove this note. ]] 1840 ttl: An 8 bit field indicating the number of iterations, or hops, a 1841 message can experience before it is discarded. The TTL value MUST 1842 be decremented by one at every hop along the route the message 1843 traverses. If the TTL is 0, the message MUST NOT be propagated 1844 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1845 should be generated. The initial value of the TTL SHOULD be 100 1846 unless defined otherwise by the overlay configuration. 1848 fragment: This field is used to handle fragmentation. The high 1849 order two bits are used to indicate the fragmentation status: If 1850 the high bit (0x80000000) is set, it indicates that the message is 1851 a fragment. If the next bit (0x40000000) is set, it indicates 1852 that this is the last fragment. The next six bits (0x20000000 to 1853 0x01000000) are reserved and SHOULD be set to zero. The remainder 1854 of the field is used to indicate the fragment offset; see 1855 Section 5.7 1857 length: The count in bytes of the size of the message, including the 1858 header. 1860 transaction_id: A unique 64 bit number that identifies this 1861 transaction and also allows receivers to disambiguate transactions 1862 which are otherwise identical. Responses use the same Transaction 1863 ID as the request they correspond to. Transaction IDs are also 1864 used for fragment reassembly. 1866 max_response_length: The maximum size in bytes of a response. Used 1867 by requesting nodes to avoid receiving (unexpected) very large 1868 responses. If this value is non-zero, responding peers MUST check 1869 that any response would not exceed it and if so generate an 1870 Error_Response_Too_Large value. This value SHOULD be set to zero 1871 for responses. 1873 via_list_length: The length of the via list in bytes. Note that in 1874 this field and the following two length fields we depart from the 1875 usual variable-length convention of having the length immediately 1876 precede the value in order to make it easier for hardware decoding 1877 engines to quickly determine the length of the header. 1879 destination_list_length: The length of the destination list in 1880 bytes. 1882 options_length: The length of the header options in bytes. 1884 via_list: The via_list contains the sequence of destinations through 1885 which the message has passed. The via_list starts out empty and 1886 grows as the message traverses each peer. 1888 destination_list: The destination_list contains a sequence of 1889 destinations which the message should pass through. The 1890 destination list is constructed by the message originator. The 1891 first element in the destination list is where the message goes 1892 next. The list shrinks as the message traverses each listed peer. 1894 options: Contains a series of ForwardingOptions entries. See 1895 Section 5.3.2.3. 1897 5.3.2.1. Processing Configuration Sequence Numbers 1899 In order to be part of the overlay, a node MUST have a copy of the 1900 overlay configuration document. In order to allow for configuration 1901 document changes, each version of the configuration document has a 1902 sequence number which is monotonically increasing mod 65536. Because 1903 the sequence number may in principle wrap, greater than or less than 1904 are interpreted by modulo arithmetic as in TCP. 1906 When a destination node receives a request, it MUST check that the 1907 configuration_sequence field is equal to its own configuration 1908 sequence number. If they do not match, it MUST generate an error, 1909 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1910 the configuration file in the request is too old, it MUST generate a 1911 Config_Update message to update the requesting node. This allows new 1912 configuration documents to propagate quickly throughout the system. 1913 The one exception to this rule is that if the configuration_sequence 1914 field is equal to 0xffff, and the message type is Config_Update, then 1915 the message MUST be accepted regardless of the receiving node's 1916 configuration sequence number. 1918 5.3.2.2. Destination and Via Lists 1920 The destination list and via lists are sequences of Destination 1921 values: 1923 enum {reserved(0), node(1), resource(2), compressed(3), 1924 /* 128-255 not allowed */ (255) } 1925 DestinationType; 1927 select (destination_type) { 1928 case node: 1929 NodeId node_id; 1931 case resource: 1932 ResourceId resource_id; 1934 case compressed: 1935 opaque compressed_id<0..2^8-1>; 1937 /* This structure may be extended with new types */ 1939 } DestinationData; 1941 struct { 1942 DestinationType type; 1943 uint8 length; 1944 DestinationData destination_data; 1945 } Destination; 1947 struct { 1948 uint16 compressed_id; /* top bit MUST be 1 */ 1949 } Destination; 1951 If destination structure has its first bit set to 1, then it is a 16 1952 bit integer. If the first bit is not set, then it is a structure 1953 starting with DestinationType. If it is a 16 bit integer, it is 1954 treated as if it were a full structure with a DestinationType of 1955 compressed and a compressed_id that was 2 bytes long with the value 1956 of the 16 bit integer. When the destination structure is not a 16 1957 bit integer, it is the TLV structure with the following contents: 1959 type 1960 The type of the DestinationData PDU. This may be one of "peer", 1961 "resource", or "compressed". 1963 length 1964 The length of the destination_data. 1966 destination_value 1967 The destination value itself, which is an encoded DestinationData 1968 structure, depending on the value of "type". 1970 Note: This structure encodes a type, length, value. The length 1971 field specifies the length of the DestinationData values, which 1972 allows the addition of new DestinationTypes. This allows an 1973 implementation which does not understand a given DestinationType 1974 to skip over it. 1976 A DestinationData can be one of three types: 1978 peer 1979 A Node-ID. 1981 compressed 1982 A compressed list of Node-IDs and/or resources. Because this 1983 value was compressed by one of the peers, it is only meaningful to 1984 that peer and cannot be decoded by other peers. Thus, it is 1985 represented as an opaque string. 1987 resource 1988 The Resource-ID of the resource which is desired. This type MUST 1989 only appear in the final location of a destination list and MUST 1990 NOT appear in a via list. It is meaningless to try to route 1991 through a resource. 1993 One possible encoding of the 16 bit integer version as an opaque 1994 identifier is to encode an index into a connection table. To avoid 1995 misrouting responses in the event a response is delayed and the 1996 connection table entry has changed, the identifier should be split 1997 between an index and a generation counter for that index. At 1998 startup, the generation counters should be initialized to random 1999 values. An implementation could use 12 bits for the connection table 2000 index and 3 bits for the generation counter. (Note that this does 2001 not suggest a 4096 entry connection table for every node, only the 2002 ability to encode for a larger connection table.) When a connection 2003 table slot is used for a new connection, the generation counter is 2004 incremented (with wrapping). Connection table slots are used on a 2005 rotating basis to maximize the time interval between uses of the same 2006 slot for different connections. When routing a message to an entry 2007 in the destination list encoding a connection table entry, the node 2008 confirms that the generation counter matches the current generation 2009 counter of that index before forwarding the message. If it does not 2010 match, the message is silently dropped. 2012 Regardless of how the 16 bit integer field or opaque DestinationType 2013 is used, the encoding MUST include a generation counter designed to 2014 prevent misrouting of responses due to the connection table entry 2015 having changed since the request message was originally forwarded. 2017 5.3.2.3. Forwarding Options 2019 The Forwarding header can be extended with forwarding header options, 2020 which are a series of ForwardingOptions structures: 2022 enum { directResponseForwarding(1), (255) } ForwardingOptionsType; 2024 struct { 2025 ForwardingOptionsType type; 2026 uint8 flags; 2027 uint16 length; 2028 select (type) { 2029 case directResponseForwarding: 2030 DirectResponseForwardingOption directResponseForwardingOption; 2032 /* This type may be extended */ 2033 } option; 2034 } ForwardingOption; 2036 Each ForwardingOption consists of the following values: 2038 type 2039 The type of the option. This structure allows for unknown options 2040 types. 2042 length 2043 The length of the rest of the structure. 2045 flags 2046 Three flags are defined FORWARD_CRITICAL(0x01), 2047 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2048 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2049 set, any node that would forward the message but does not 2050 understand this options MUST reject the request with an 2051 Error_Unsupported_Forwarding_Option error response. If the 2052 DESTINATION_CRITICAL flag is set, any node that generates a 2053 response to the message but does not understand the forwarding 2054 option MUST reject the request with an 2055 Error_Unsupported_Forwarding_Option error response. If the 2056 RESPONSE_COPY flag is set, any node generating a response MUST 2057 copy the option from the request to the response and clear the 2058 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags. 2060 option 2061 The option value. 2063 5.3.2.4. Direct Return Response Forwarding Options 2065 NOTE: This section does not have working group consensus but to help 2066 facilitate discussion of the topic, the authors have included it in 2067 the text. This section will be adjusted or removed in the next 2068 version to represent working group consensus. 2070 This section defines an OPTIONAL forwarding option that allows the 2071 originator of a request to signal that the node responsindg to the 2072 request should try to route the response directly to the node that 2073 made the request instead of having the responses traverse the 2074 overlay. : 2076 struct { 2077 AttachReqAns connection_information; 2078 NodeID requesting_node; 2079 } DirectResponseForwardingOption; 2081 Each ForwardingOption consists of the following values: 2083 connection_information 2084 All of the information needed to initiate a new connection to the 2085 requesting node. 2087 requesting_node 2088 The NodeID of the node that originated the request. This is used 2089 to match the TLS certificate. 2091 This option can only be used if the 2092 DirecteRetrurnResonsoseRoutingAllowed flag in the configuration for 2093 the overlay is set to true. The RESPONSE_COPY flag SHOULD be set to 2094 false while the FORWARD_CRITICAL and DESTINATION_CRITICAL SHOULD be 2095 set to true. When a node that supports this forwarding options 2096 receives a request with it, it acts as if it had send an Attache 2097 request to the the requesting_node and it had received the 2098 connection_information in the answer. This cases it to form a new 2099 connection directly to that node. Once that is complete the response 2100 to this request is sent over that connection. If a connection 2101 already exists directly to that node, it is used instead of a a new 2102 connection being formed. The connection MAY be closed at any point 2103 but is typically kept open until TODO (need WG input). [ TODO - add 2104 appropriate text to configuration file ] 2106 5.3.3. Message Contents Format 2108 The second major part of a RELOAD message is the contents part, which 2109 is defined by MessageContents: 2111 enum { (2^16-1) } MessageExtensionType; 2113 struct { 2114 MessageExtensionType type; 2115 Boolean critical; 2116 opaque extension_contents<0..2^32-1>; 2117 } MessageExtension; 2119 struct { 2120 uint16 message_code; 2121 opaque message_body<0..2^32-1>; 2122 MessageExtensions extensions<0..2^32-1>; 2123 } MessageContents; 2125 The contents of this structure are as follows: 2127 message_code 2128 This indicates the message that is being sent. The code space is 2129 broken up as follows. 2131 0 Reserved 2133 1 .. 0x7fff Requests and responses. These code points are always 2134 paired, with requests being odd and the corresponding response 2135 being the request code plus 1. Thus, "probe_request" (the 2136 Probe request) has value 1 and "probe_answer" (the Probe 2137 response) has value 2 2139 0xffff Error 2141 message_body 2142 The message body itself, represented as a variable-length string 2143 of bytes. The bytes themselves are dependent on the code value. 2144 See the sections describing the various RELOAD methods (Join, 2145 Update, Attach, Store, Fetch, etc.) for the definitions of the 2146 payload contents. 2147 extensions 2148 Extensions to the message. Currently no extensions are defined, 2149 but new extensions can be defined by the process described in 2150 Section 13.12. 2152 All extensions have the following form: 2154 type 2155 The extension type. 2157 critical 2158 Whether this extension must be understood in order to process the 2159 message. If critical = True and the recipient does not understand 2160 the message, it MUST generate an Error_Unknown_Extension error. 2161 If critical = False, the recipient SHOULD choose to process the 2162 message even if it does not understand the extension. 2164 extension_contents 2165 The contents of the extension (extension-dependent). 2167 5.3.3.1. Response Codes and Response Errors 2169 A peer processing a request returns its status in the message_code 2170 field. If the request was a success, then the message code is the 2171 response code that matches the request (i.e., the next code up). The 2172 response payload is then as defined in the request/response 2173 descriptions. 2175 If the request has failed, then the message code is set to 0xffff 2176 (error) and the payload MUST be an error_response PDU, as shown 2177 below. 2179 When the message code is 0xffff, the payload MUST be an 2180 ErrorResponse. 2182 public struct { 2183 uint16 error_code; 2184 opaque error_info<0..2^16-1>; 2185 } ErrorResponse; 2187 The contents of this structure are as follows: 2189 error_code 2190 A numeric error code indicating the error that occurred. 2192 error_info 2193 An optional arbitrary byte string. Unless otherwise specified, 2194 this will be a UTF-8 text string providing further information 2195 about what went wrong. 2197 The following error code values are defined. The numeric values for 2198 these are defined in Section 13.8. 2200 Error_Forbidden: The requesting node does not have permission to 2201 make this request. 2203 Error_Not_Found: The resource or peer cannot be found or does not 2204 exist. 2206 Error_Request_Timeout: A response to the request has not been 2207 received in a suitable amount of time. The requesting node MAY 2208 resend the request at a later time. 2210 Error_Data_Too_Old: A store cannot be completed because the 2211 storage_time precedes the existing value. 2213 Error_Generation_Counter_Too_Low: A store cannot be completed 2214 because the generation counter precedes the existing value. 2216 Error_Incompatible_with_Overlay: A peer receiving the request is 2217 using a different overlay, overlayalgorithm, or hash algorithm. 2219 Error_Unsupported_Forwarding_Option: A peer receiving the request 2220 with a forwarding options flagged as critical but the peer does 2221 not support this option. See section Section 5.3.2.3. 2223 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2224 decremented to zero. See section Section 5.3.2. 2226 Error_Message_Too_Large: A peer receiving the request that was too 2227 large. See section Section 5.6. 2229 Error_Response_Too_Large: A peer would have generated a response 2230 that is too large per the max_response_length field. 2232 Error_Config_Too_Old: A destination peer received a request with a 2233 configuration sequence that's too old. 2235 Error_Config_Too_New: A destination node received a request with a 2236 configuration sequence that's too new. A node which receives this 2237 error MUST generate a Config_Update message to send a new copy of 2238 the configuration document to the node which generated the error. 2240 Error_Unknown_Kind: A destination node received a request with an 2241 unknown kind-id. A node which receives this error MUST generate a 2242 Config_Update message which contains the appropriate kind 2243 definition. 2244 Error_Unknown_Extension: A destination node received a request with 2245 an unknown extension. 2247 5.3.4. Security Block 2249 The third part of a RELOAD message is the security block. The 2250 security block is represented by a SecurityBlock structure: 2252 enum { x509(0), (255) } certificate_type; 2254 struct { 2255 certificate_type type; 2256 opaque certificate<0..2^16-1>; 2257 } GenericCertificate; 2259 struct { 2260 GenericCertificate certificates<0..2^16-1>; 2261 Signature signature; 2262 } SecurityBlock; 2263 The contents of this structure are: 2265 certificates 2266 A bucket of certificates. 2268 signature 2269 A signature over the message contents. 2271 The certificates bucket SHOULD contain all the certificates necessary 2272 to verify every signature in both the message and the internal 2273 message objects. This is the only location in the message which 2274 contains certificates, thus allowing for only a single copy of each 2275 certificate to be sent. In systems which have some alternate 2276 certificate distribution mechanism, some certificates MAY be omitted. 2277 However, implementors should note that this creates the possibility 2278 that messages may not be immediately verifiable because certificates 2279 must first be retrieved. 2281 Each certificate is represented by a GenericCertificate structure, 2282 which has the following contents: 2284 type 2285 The type of the certificate. Only one type is defined: x509 2286 representing an X.509 certificate. 2288 certificate 2289 The encoded version of the certificate. For X.509 certificates, 2290 it is the DER form. 2292 The signature is computed over the payload and parts of the 2293 forwarding header. The payload, in case of a Store, may contain an 2294 additional signature computed over a StoreReq structure. All 2295 signatures are formatted using the Signature element. This element 2296 is also used in other contexts where signatures are needed. The 2297 input structure to the signature computation varies depending on the 2298 data element being signed. 2300 enum {reserved(0), cert_hash(1), (255)} SignerIdentityType; 2302 select (identity_type) { 2303 case cert_hash; 2304 HashAlgorithm hash_alg; 2305 opaque certificate_hash<0..2^8-1>; 2307 /* This structure may be extended with new types if necessary*/ 2308 } SignerIdentityValue; 2310 struct { 2311 SignerIdentityType identity_type; 2312 uint16 length; 2313 SignerIdentityValue identity[SignerIdentity.length]; 2314 } SignerIdentity; 2316 struct { 2317 SignatureAndHashAlgorithm algorithm; 2318 SignerIdentity identity; 2319 opaque signature_value<0..2^16-1>; 2320 } Signature; 2322 The signature construct contains the following values: 2324 algorithm 2325 The signature algorithm in use. The algorithm definitions are 2326 found in the IANA TLS SignatureAlgorithm Registry. 2328 identity 2329 The identity used to form the signature. 2331 signature_value 2332 The value of the signature. 2334 The only currently permitted identity format is a hash of the 2335 signer's certificate. The hash_alg field is used to indicate the 2336 algorithm used to produce the hash. The certificate_hash contains 2337 the hash of the certificate object. The SignerIdentity structure is 2338 typed purely to allow for future (unanticipated) extensibility. 2340 For signatures over messages the input to the signature is computed 2341 over: 2343 overlay + transaction_id + MessageContents + SignerIdentity 2345 where overlay and transaction_id come from the forwarding header and 2346 + indicates concatenation. 2348 The input to signatures over data values is different, and is 2349 described in Section 6.1. 2351 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2352 MUST verify the signature and the authorizing certificate. This 2353 check provides a minimal level of assurance that the sending node is 2354 a valid part of the overlay as well as cryptographic authentication 2355 of the sending node. In addition, responses MUST be checked as 2356 follows: 2358 1. The response to a message sent to a specific Node-ID MUST have 2359 been sent by that Node-ID. 2360 2. The response to a message sent to a Resource-Id MUST have been 2361 sent by a Node-ID which is as close to or closer to the target 2362 Resource-Id than any node in the requesting node's neighbor 2363 table. 2365 The second condition serves as a primitive check for responses from 2366 wildly wrong nodes but is not a complete check. Note that in periods 2367 of churn, it is possible for the requesting node to obtain a closer 2368 neighbor while the request is outstanding. This will cause the 2369 response to be rejected and the request to be retransmitted. 2371 In addition, some methods (especially Store) have additional 2372 authentication requirements, which are described in the sections 2373 covering those methods. 2375 5.4. Overlay Topology 2377 As discussed in previous sections, RELOAD does not itself implement 2378 any overlay topology. Rather, it relies on Topology Plugins, which 2379 allow a variety of overlay algorithms to be used while maintaining 2380 the same RELOAD core. This section describes the requirements for 2381 new topology plugins and the methods that RELOAD provides for overlay 2382 topology maintenance. 2384 5.4.1. Topology Plugin Requirements 2386 When specifying a new overlay algorithm, at least the following need 2387 to be described: 2389 o Joining procedures, including the contents of the Join message. 2390 o Stabilization procedures, including the contents of the Update 2391 message, the frequency of topology probes and keepalives, and the 2392 mechanism used to detect when peers have disconnected. 2393 o Exit procedures, including the contents of the Leave message. 2395 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2396 compute the hash of an identifier. 2397 o The procedures that peers use to route messages. 2398 o The replication strategy used to ensure data redundancy. 2400 All overlay algorithms MUST specify maintenance procedures that send 2401 Updates to clients and peers that have established connections to the 2402 peer responsible for a particular ID when the responsibility for that 2403 ID changes. Because tracking this information is difficult, overlay 2404 algorithms MAY simply specify that an Update is sent to all members 2405 of the Connection Table whenever the range of IDs for which the peer 2406 is responsible changes. 2408 5.4.2. Methods and types for use by topology plugins 2410 This section describes the methods that topology plugins use to join, 2411 leave, and maintain the overlay. 2413 5.4.2.1. Join 2415 A new peer (but one that already has credentials) uses the JoinReq 2416 message to join the overlay. The JoinReq is sent to the responsible 2417 peer depending on the routing mechanism described in the topology 2418 plugin. This notifies the responsible peer that the new peer is 2419 taking over some of the overlay and it needs to synchronize its 2420 state. 2422 struct { 2423 NodeId joining_peer_id; 2424 opaque overlay_specific_data<0..2^16-1>; 2425 } JoinReq; 2427 The minimal JoinReq contains only the Node-ID which the sending peer 2428 wishes to assume. Overlay algorithms MAY specify other data to 2429 appear in this request. 2431 If the request succeeds, the responding peer responds with a JoinAns 2432 message, as defined below: 2434 struct { 2435 opaque overlay_specific_data<0..2^16-1>; 2436 } JoinAns; 2438 If the request succeeds, the responding peer MUST follow up by 2439 executing the right sequence of Stores and Updates to transfer the 2440 appropriate section of the overlay space to the joining peer. In 2441 addition, overlay algorithms MAY define data to appear in the 2442 response payload that provides additional info. 2444 In general, nodes which cannot form connections SHOULD report an 2445 error. However, implementations MUST provide some mechanism whereby 2446 nodes can determine that they are potentially the first node and take 2447 responsibility for the overlay. This specification does not mandate 2448 any particular mechanism, but a configuration flag or setting seems 2449 appropriate. 2451 5.4.2.2. Leave 2453 The LeaveReq message is used to indicate that a node is exiting the 2454 overlay. A node SHOULD send this message to each peer with which it 2455 is directly connected prior to exiting the overlay. 2457 public struct { 2458 NodeId leaving_peer_id; 2459 opaque overlay_specific_data<0..2^16-1>; 2460 } LeaveReq; 2462 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2463 algorithms MAY specify other data to appear in this request. 2465 Upon receiving a Leave request, a peer MUST update its own routing 2466 table, and send the appropriate Store/Update sequences to re- 2467 stabilize the overlay. 2469 5.4.2.3. Update 2471 Update is the primary overlay-specific maintenance message. It is 2472 used by the sender to notify the recipient of the sender's view of 2473 the current state of the overlay (its routing state), and it is up to 2474 the recipient to take whatever actions are appropriate to deal with 2475 the state change. In general, peers send Update messages to all 2476 their adjacencies whenever they detect a topology shift. 2478 When a peer detects through an Update that it is no longer 2479 responsible for any data value it is storing, it MUST attempt to 2480 Store a copy to the correct node unless it knows the the newly 2481 responsible node already has a copy of the data. This prevents data 2482 loss during large-scale topology shifts such as the merging of 2483 partitioned overlays. 2485 The contents of the UpdateReq message are completely overlay- 2486 specific. The UpdateAns response is expected to be either success or 2487 an error. 2489 5.4.2.4. Route_Query 2491 The Route_Query request allows the sender to ask a peer where they 2492 would route a message directed to a given destination. In other 2493 words, a RouteQuery for a destination X requests the Node-ID for the 2494 node that the receiving peer would next route to in order to get to 2495 X. A RouteQuery can also request that the receiving peer initiate an 2496 Update request to transfer the receiving peer's routing table. 2498 One important use of the RouteQuery request is to support iterative 2499 routing. The sender selects one of the peers in its routing table 2500 and sends it a RouteQuery message with the destination_object set to 2501 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2502 responds with information about the peers to which the request would 2503 be routed. The sending peer MAY then use the Attach method to attach 2504 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2505 gets a response from a peer that is closest to the identifier in the 2506 destination_object as determined by the topology plugin. At that 2507 point, the sender can send messages directly to that peer. 2509 5.4.2.4.1. Request Definition 2511 A RouteQueryReq message indicates the peer or resource that the 2512 requesting node is interested in. It also contains a "send_update" 2513 option allowing the requesting node to request a full copy of the 2514 other peer's routing table. 2516 struct { 2517 Boolean send_update; 2518 Destination destination; 2519 opaque overlay_specific_data<0..2^16-1>; 2520 } RouteQueryReq; 2522 The contents of the RouteQueryReq message are as follows: 2524 send_update 2525 A single byte. This may be set to "true" to indicate that the 2526 requester wishes the responder to initiate an Update request 2527 immediately. Otherwise, this value MUST be set to "false". 2529 destination 2530 The destination which the requester is interested in. This may be 2531 any valid destination object, including a Node-ID, compressed ids, 2532 or Resource-ID. 2534 overlay_specific_data 2535 Other data as appropriate for the overlay. 2537 5.4.2.4.2. Response Definition 2539 A response to a successful RouteQueryReq request is a RouteQueryAns 2540 message. This is completely overlay specific. 2542 5.4.2.5. Probe 2544 Probe provides primitive "exploration" services: it allows node to 2545 determine which resources another node is responsible for; and it 2546 allows some discovery services using multicast, anycast, or 2547 broadcast. A probe can be addressed to a specific Node-ID, or the 2548 peer controlling a given location (by using a resource ID). In 2549 either case, the target Node-IDs respond with a simple response 2550 containing some status information. 2552 5.4.2.5.1. Request Definition 2554 The ProbeReq message contains a list (potentially empty) of the 2555 pieces of status information that the requester would like the 2556 responder to provide. 2558 enum { responsible_set(1), num_resources(2), uptime(3), (255)} 2559 ProbeInformationType; 2561 struct { 2562 ProbeInformationType requested_info<0..2^8-1>; 2563 } ProbeReq 2565 The currently defined values for ProbeInformation are: 2567 responsible_set 2568 indicates that the peer should Respond with the fraction of the 2569 overlay for which the responding peer is responsible. 2571 num_resources 2572 indicates that the peer should Respond with the number of 2573 resources currently being stored by the peer. 2575 uptime 2576 indicates that the peer should Respond with how long the peer has 2577 been up in seconds. 2579 5.4.2.5.2. Response Definition 2581 A successful ProbeAns response contains the information elements 2582 requested by the peer. 2584 struct { 2585 select (type) { 2586 case responsible_set: 2587 uint32 responsible_ppb; 2589 case num_resources: 2590 uint32 num_resources; 2592 case uptime: 2593 uint32 uptime; 2594 /* This type may be extended */ 2596 }; 2597 } ProbeInformationData; 2599 struct { 2600 ProbeInformationType type; 2601 uint8 length; 2602 ProbeInformationData value; 2603 } ProbeInformation; 2605 struct { 2606 ProbeInformation probe_info<0..2^16-1>; 2607 } ProbeAns; 2609 A ProbeAns message contains a sequence of ProbeInformation 2610 structures. Each has a "length" indicating the length of the 2611 following value field. This structure allows for unknown options 2612 types. 2614 Each of the current possible Probe information types is a 32-bit 2615 unsigned integer. For type "responsible_ppb", it is the fraction of 2616 the overlay for which the peer is responsible in parts per billion. 2617 For type "num_resources", it is the number of resources the peer is 2618 storing. For the type "uptime" it is the number of seconds the peer 2619 has been up. 2621 The responding peer SHOULD include any values that the requesting 2622 node requested and that it recognizes. They SHOULD be returned in 2623 the requested order. Any other values MUST NOT be returned. 2625 5.5. Forwarding and Link Management Layer 2627 Each node maintains connections to a set of other nodes defined by 2628 the topology plugin. This section defines the methods RELOAD uses to 2629 form and maintain connections between nodes in the overlay. Three 2630 methods are defined: 2632 Attach: used to form RELOAD connections between nodes. When node 2633 A wants to connect to node B, it sends an Attach message to node B 2634 through the overlay. The Attach contains A's ICE parameters. B 2635 responds with its ICE parameters and the two nodes perform ICE to 2636 form connection. Attach also allows two nodes to connect via No- 2637 ICE instead of full ICE. 2638 AppAttach: used to form application layer connections between 2639 nodes. 2640 Ping: is a simple request/response which is used to verify 2641 connectivity of the target peer. 2643 5.5.1. Attach 2645 A node sends an Attach request when it wishes to establish a direct 2646 TCP or UDP connection to another node for the purpose of sending 2647 RELOAD messages. 2649 As described in Section 5.1, an Attach may be routed to either a 2650 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2651 will fail if that node is not reached. An Attach routed to a 2652 Resource-ID will establish a connection with the peer currently 2653 responsible for that Resource-ID, which may be useful in establishing 2654 a direct connection to the responsible peer for use with frequent or 2655 large resource updates. 2657 An Attach in and of itself does not result in updating the routing 2658 table of either node. That function is performed by Updates. If 2659 node A has Attached to node B, but not received any Updates from B, 2660 it MAY route messages which are directly addressed to B through that 2661 channel but MUST NOT route messages through B to other peers via that 2662 channel. The process of Attaching is separate from the process of 2663 becoming a peer (using Join and Update), to prevent half-open states 2664 where a node has started to form connections but is not really ready 2665 to act as a peer. Thus, clients (unlike peers) can simply Attach 2666 without sending Join or Update. 2668 5.5.1.1. Request Definition 2670 An Attach request message contains the requesting node ICE connection 2671 parameters formatted into a binary structure. 2673 enum { reserved(0), DTLS-UDP-SR(1), 2674 DLTS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2675 (255) } OverlayLink; 2677 enum { reserved(0), host(1), srflx(2), prflx(3), relay(4), 2678 (255) } CandType; 2680 struct { 2681 opaque name<2^16-1>; 2682 opaque value<2^16-1>; 2683 } IceExtension; 2685 struct { 2686 IpAddressPort addr_port; 2687 OverlayLink overlay_link; 2688 opaque foundation<0..255>; 2689 uint32 priority; 2690 CandType type; 2691 select (type){ 2692 case host: 2693 ; /* Nothing */ 2694 case srflx: 2695 case prflx: 2696 case relay: 2697 IpAddressPort rel_addr_port; 2698 } 2699 IceExtension extensions<0..2^16-1>; 2700 } IceCandidate; 2702 struct { 2703 opaque ufrag<0..2^8-1>; 2704 opaque password<0..2^8-1>; 2705 opaque role<0..2^8-1>; 2706 IceCandidate candidates<0..2^16-1>; 2707 } AttachReqAns; 2709 The values contained in AttachReqAns are: 2711 ufrag 2712 The username fragment (from ICE). 2714 password 2715 The ICE password. 2717 role 2718 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2719 value MUST be 'passive' for the offerer (the peer sending the 2720 Attach request) and 'active' for the answerer (the peer sending 2721 the Attach response). 2723 candidates 2724 One or more ICE candidate values, as described below. 2726 Each ICE candidate is represented as an IceCandidate structure, which 2727 is a direct translation of the information from the ICE string 2728 structures, with the exception of the component ID. Since there is 2729 only one component, it is always 1, and thus left out of the PDU. 2730 The remaining values are specified as follows: 2732 addr_port 2733 corresponds to the connection-address and port productions. 2735 overlay_link 2736 corresponds to the OverlayLink production, Overlay Link protocols 2737 used with No ICE MUST specify "no ICE" in their description. 2738 Future overlay link values can be added be defining new 2739 OverlayLink values in the IANA registry in Section 13.9. Future 2740 extensions to the encapsulation or framing that provide for 2741 backward compatibility with that specified by a previously defined 2742 OverlayLink values MUST use that previous value. OverlayLink 2743 protocols are defined in Section 5.6 2744 A single AttachReqAns MUST NOT include both candidates whose 2745 OverlayLink protocols use ICE (the default) and candidates that 2746 specify "no ICE". 2748 foundation 2749 corresponds to the foundation production. 2751 priority 2752 corresponds to the priority production. 2754 type 2755 corresponds to the cand-type production. 2757 rel_addr_port 2758 corresponds to the rel-addr and rel-port productions. Only 2759 present for type "relay". 2761 extensions 2762 ICE extensions. The name and value fields correspond to binary 2763 translations of the equivalent fields in the ICE extensions. 2765 These values should be generated using the procedures described in 2766 Section 5.5.1.3. 2768 5.5.1.2. Response Definition 2770 If a peer receives an Attach request, it SHOULD process the request 2771 and generate its own response with a AttachReqAns. It should then 2772 begin ICE checks. When a peer receives an Attach response, it SHOULD 2773 parse the response and begin its own ICE checks. 2775 5.5.1.3. Using ICE With RELOAD 2777 This section describes the profile of ICE that is used with RELOAD. 2778 RELOAD implementations MUST implement full ICE. 2780 In ICE as defined by [I-D.ietf-mmusic-ice], SDP is used to carry the 2781 ICE parameters. In RELOAD, this function is performed by a binary 2782 encoding in the Attach method. This encoding is more restricted than 2783 the SDP encoding because the RELOAD environment is simpler: 2785 o Only a single media stream is supported. 2786 o In this case, the "stream" refers not to RTP or other types of 2787 media, but rather to a connection for RELOAD itself or for SIP 2788 signaling. 2789 o RELOAD only allows for a single offer/answer exchange. Unlike the 2790 usage of ICE within SIP, there is never a need to send a 2791 subsequent offer to update the default candidates to match the 2792 ones selected by ICE. 2794 An agent follows the ICE specification as described in 2795 [I-D.ietf-mmusic-ice] with the changes and additional procedures 2796 described in the subsections below. 2798 5.5.1.4. Collecting STUN Servers 2800 ICE relies on the node having one or more STUN servers to use. In 2801 conventional ICE, it is assumed that nodes are configured with one or 2802 more STUN servers through some out-of-band mechanism. This is still 2803 possible in RELOAD but RELOAD also learns STUN servers as it connects 2804 to other peers. Because all RELOAD peers implement ICE and use STUN 2805 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2806 peer a node knows will be willing to be a STUN server -- though of 2807 course it may be behind a NAT. 2809 A peer on a well-provisioned wide-area overlay will be configured 2810 with one or more bootstrap nodes. These nodes make an initial list 2811 of STUN servers. However, as the peer forms connections with 2812 additional peers, it builds more peers it can use as STUN servers. 2814 Because complicated NAT topologies are possible, a peer may need more 2815 than one STUN server. Specifically, a peer that is behind a single 2816 NAT will typically observe only two IP addresses in its STUN checks: 2817 its local address and its server reflexive address from a STUN server 2818 outside its NAT. However, if there are more NATs involved, it may 2819 learn additional server reflexive addresses (which vary based on 2820 where in the topology the STUN server is). To maximize the chance of 2821 achieving a direct connection, a peer SHOULD group other peers by the 2822 peer-reflexive addresses it discovers through them. It SHOULD then 2823 select one peer from each group to use as a STUN server for future 2824 connections. 2826 Only peers to which the peer currently has connections may be used. 2827 If the connection to that host is lost, it MUST be removed from the 2828 list of stun servers and a new server from the same group SHOULD be 2829 selected. 2831 5.5.1.5. Gathering Candidates 2833 When a node wishes to establish a connection for the purposes of 2834 RELOAD signaling or application signaling, it follows the process of 2835 gathering candidates as described in Section 4 of ICE 2836 [I-D.ietf-mmusic-ice]. RELOAD utilizes a single component. 2837 Consequently, gathering for these "streams" requires a single 2838 component. In the case where a node has not yet found a TURN server, 2839 the agent would not include a relayed candidate. 2841 The ICE specification assumes that an ICE agent is configured with, 2842 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2843 for an agent to learn these by querying the overlay, as described in 2844 Section 5.5.1.4 and Section 8. 2846 The default candidate selection described in Section 4.1.4 of ICE is 2847 ignored; defaults are not signaled or utilized by RELOAD. 2849 An alternative to using the full ICE supported by the Attach request 2850 is to use No-ICE mechanism by providing candidates with "no ICE" 2851 Overlay Link protocols. Configuration for the overlay indicates 2852 whether or not these Overlay Link protocols can be used. A node MUST 2853 only use ICE or No-ICE candidates within one AttachReqAns. No-ICE 2854 will not work in all of the scenarios where ICE would work, but in 2855 some cases, particularly those with no NATs or firewalls, it will 2856 work. It is RECOMMENDED that full ICE be used even for a node that 2857 has a public, unfiltered IP address, to take advantage of STUN 2858 connectivity checks, etc. 2860 5.5.1.6. Prioritizing Candidates 2862 At the time of writing, UDP is the only transport protocol specified 2863 to work with ICE. However, standardization of additional protocols 2864 for use with ICE is expected, including TCP and datagram-oriented 2865 protocols such as SCTP and DCCP. In particular, UDP encapsulations 2866 for SCTP and DCCP are expected to be standardized in the near future, 2867 greatly expanding the available Overlay Link protocols available for 2868 RELOAD. When additional protocols are available, the following 2869 prioritization is RECOMMENDED: 2871 o Highest priority is assigned to message-oriented protocols that 2872 offer well-understood congestion and flow control without head-of- 2873 line blocking. For example, SCTP without message ordering, DCCP, 2874 or those protocols encapsulated using UDP. 2875 o Second highest priority is assigned to stream-oriented protocols, 2876 e.g. TCP. 2877 o Lowest priority is assigned to protocols encapsulated over UDP 2878 that do not implement well-established congestion control 2879 algorithms. For example, the DTLS/UDP with SR overlay link 2880 protocol. 2882 5.5.1.7. Encoding the Attach Message 2884 Section 4.3 of ICE describes procedures for encoding the SDP for 2885 conveying RELOAD candidates. Instead of actually encoding an SDP, 2886 the candidate information (IP address and port and transport 2887 protocol, priority, foundation, type and related address) is carried 2888 within the attributes of the Attach request or its response. 2889 Similarly, the username fragment and password are carried in the 2890 Attach message or its response. Section 5.5.1 describes the detailed 2891 attribute encoding for Attach. The Attach request and its response 2892 do not contain any default candidates or the ice-lite attribute, as 2893 these features of ICE are not used by RELOAD. 2895 Since the Attach request contains the candidate information and short 2896 term credentials, it is considered as an offer for a single media 2897 stream that happens to be encoded in a format different than SDP, but 2898 is otherwise considered a valid offer for the purposes of following 2899 the ICE specification. Similarly, the Attach response is considered 2900 a valid answer for the purposes of following the ICE specification. 2902 5.5.1.8. Verifying ICE Support 2904 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2905 of ICE. Since RELOAD requires full ICE from all agents, this check 2906 is not required. 2908 5.5.1.9. Role Determination 2910 The roles of controlling and controlled as described in Section 5.2 2911 of ICE are still utilized with RELOAD. However, the offerer (the 2912 entity sending the Attach request) will always be controlling, and 2913 the answerer (the entity sending the Attach response) will always be 2914 controlled. The connectivity checks MUST still contain the ICE- 2915 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2916 role reversal capability for which they are defined will never be 2917 needed with RELOAD. This is to allow for a common codebase between 2918 ICE for RELOAD and ICE for SDP. 2920 5.5.1.10. Full ICE 2922 When neither side has provided an No-ICE candidate, connectivity 2923 checks and nominations are used as in regular ICE. 2925 5.5.1.10.1. Connectivity Checks 2927 The processes of forming check lists in Section 5.7 of ICE, 2928 scheduling checks in Section 5.8, and checking connectivity checks in 2929 Section 7 are used with RELOAD without change. 2931 5.5.1.10.2. Concluding ICE 2933 The controlling agent MUST utilize regular nomination. This is to 2934 ensure consistent state on the final selected pairs without the need 2935 for an updated offer, as RELOAD does not generate additional offer/ 2936 answer exchanges. 2938 The procedures in Section 8 of ICE are followed to conclude ICE, with 2939 the following exceptions: 2941 o The controlling agent MUST NOT attempt to send an updated offer 2942 once the state of its single media stream reaches Completed. 2943 o Once the state of ICE reaches Completed, the agent can immediately 2944 free all unused candidates. This is because RELOAD does not have 2945 the concept of forking, and thus the three second delay in Section 2946 8.3 of ICE does not apply. 2948 5.5.1.10.3. Media Keepalives 2950 STUN MUST be utilized for the keepalives described in Section 10 of 2951 ICE. 2953 5.5.1.11. No ICE 2955 No-ICE is selected when either side has provided "no ICE" Overlay 2956 Link candidates. STUN is not used for connectivity checks when doing 2957 No-ICE; instead the DTLS or TLS handshake (or similar security layer 2958 of future overlay link protocols) forms the connectivity check. The 2959 certificate exchanged during the (D)TLS handshake must match the node 2960 that sent the AttachReqAns and if it does not, the connection MUST be 2961 closed. 2963 5.5.1.11.1. Implementation Notes for No-ICE 2965 This is a non-normative section to help implementors. 2967 At times ICE can seem a bit daunting to get one's head around. For a 2968 simple IPv4 only peer, a simple implementation of No-ICE could be 2969 done by doing the following: 2970 o When sending an AttachReqAns, form one candidate with a priority 2971 value of (2^24)*(126)+(2^8)*(65535)+(2^0)*(256-1) that specifies 2972 the UDP port being listened to and another one with the TCP port. 2973 o Check the certificate received in the TLS handshake has the same 2974 Node-ID as the node that has sent the AttachReqAns. If multiple 2975 connections succeed, close all but the one with highest priority. 2976 o Do normal TLS and DTLS with no need for any special framing or 2977 STUN processing. 2979 5.5.1.12. Subsequent Offers and Answers 2981 An agent MUST NOT send a subsequent offer or answer. Thus, the 2982 procedures in Section 9 of ICE MUST be ignored. 2984 5.5.1.13. Sending Media 2986 The procedures of Section 11 apply to RELOAD as well. However, in 2987 this case, the "media" takes the form of application layer protocols 2988 (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE 2989 processing completes, the agent will begin TLS or DTLS procedures to 2990 establish a secure connection. The node which sent the Attach 2991 request MUST be the TLS server. The other node MUST be the TLS 2992 client. The server MUST request TLS client authentication. The 2993 nodes MUST verify that the certificate presented in the handshake 2994 matches the identity of the other peer as found in the Attach 2995 message. Once the TLS or DTLS signaling is complete, the application 2996 protocol is free to use the connection. 2998 The concept of a previous selected pair for a component does not 2999 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3001 5.5.1.14. Receiving Media 3003 An agent MUST be prepared to receive packets for the application 3004 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3005 time. The jitter and RTP considerations in Section 11 of ICE do not 3006 apply to RELOAD. 3008 5.5.2. AppAttach 3010 A node sends an AppAttach request when it wishes to establish a 3011 direct connection to another node for the purposes of sending 3012 application layer messages. AppAttach is basically like Attach, 3013 except for the purpose of the connection. A separate request is used 3014 to avoid implementor confusion between the two methods (this was 3015 found to be a real problem with initial implementations). The 3016 AppAttach request and its response contain an application attribute, 3017 which indicates what protocol is to be run over the connection. 3019 5.5.2.1. Request Definition 3021 An AppAttachReqAns message contains the requesting node's ICE 3022 connection parameters formatted into a binary structure. 3024 struct { 3025 opaque ufrag<0..2^8-1>; 3026 opaque password<0..2^8-1>; 3027 uint16 application; 3028 opaque role<0..2^8-1>; 3029 IceCandidate candidates<0..2^16-1>; 3030 } AppAttachReqAns; 3032 The values contained in AppAttachReqAns are: 3034 ufrag 3035 The username fragment (from ICE) 3037 password 3038 The ICE password. 3040 application 3041 A 16-bit application-id as defined in the Section 13.4. This 3042 number represents the IANA registered applications that is going 3043 to be sent data on this connection. For SIP, this is 5060 or 3044 5061. 3046 role 3047 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3049 candidates 3050 One or more ICE candidate values 3052 5.5.2.2. Response Definition 3054 If a peer receives an AppAttach request, it SHOULD process the 3055 request and generate its own response with a AppAttachReqAns. It 3056 should then begin ICE checks. When a peer receives an AppAttach 3057 response, it SHOULD parse the response and begin its own ICE checks. 3059 5.5.3. Ping 3061 Ping is used to test connectivity along a path. A ping can be 3062 addressed to a specific Node-ID, to the peer controlling a given 3063 location (by using a resource ID), or to the broadcast Node-ID 3064 (2^128-1). 3066 5.5.3.1. Request Definition 3068 struct { 3069 } PingReq 3071 5.5.3.2. Response Definition 3073 A successful PingAns response contains the information elements 3074 requested by the peer. 3076 struct { 3077 uint64 response_id; 3078 uint64 time; 3079 } PingAns; 3081 A PingAns message contains the following elements: 3083 response_id 3084 A randomly generated 64-bit response ID. This is used to 3085 distinguish Ping responses. 3087 time 3088 The time when the ping responses was created in absolute time, 3089 represented in milliseconds since midnight Jan 1, 1970 which is 3090 the UNIX epoch. 3092 5.5.4. Config_Update 3094 The Config_Update method is used to push updated configuration data 3095 across the overlay. Whenever a node detects that another node has 3096 old configuration data, it MUST generate a Config_Update request. 3097 The Config_Update request allows updating of two kinds of data: the 3098 configuration data (Section 5.3.2.1) and kind information 3099 (Section 6.4.1.1). 3101 5.5.4.1. Request Definition 3103 enum { reserved(0), config(1), kind(2), (255) } 3104 Config_UpdateType; 3106 typedef opaque KindDescription<2^16-1>; 3108 struct { 3109 Config_UpdateType type; 3110 uint32 length; 3112 select (type) { 3113 case config: 3114 opaque config_data<2^24-1>; 3116 case kind: 3117 KindDescription kinds<2^24-1>; 3119 /* This structure may be extended with new types*/ 3120 }; 3121 } Config_UpdateReq; 3123 The Config_UpdateReq message contains the following elements: 3125 type 3126 The type of the contents of the message. This structure allows 3127 for unknown content types. 3128 length 3129 The length of the remainder of the message. This is included to 3130 preserve backward compatibility and is 32 bits instead of 24 to 3131 facilitate easy conversion between network and host byte order. 3132 config_data (type==config) 3133 The contents of the configuration document. 3134 kinds (type==kind) 3135 One or more XML kind-block productions (see Section 10.1). These 3136 MUST be encoded with UTF-8 and assume a default namespace of 3137 "urn:ietf:params:xml:ns:p2p:config-base". 3139 5.5.4.2. Response Definition 3141 struct { 3142 } Config_UpdateReq 3144 If the Config_UpdateReq is of type "config" it MUST only be processed 3145 if all the following are true: 3146 o The sequence number in the document is greater than the current 3147 configuration sequence number. 3148 o The configuration document is correctly digitally signed (see 3149 Section 10 for details on signatures. 3150 Otherwise appropriate errors MUST be generated. 3152 If the Config_UpdateReq is of type "kind" it MUST only be processed 3153 if it is correctly digitally signed by an acceptable kind signer as 3154 specified in the configuraton file. Details on kind-signer field in 3155 the configuration file is described in Section 10.1. In addition, if 3156 the kind update conflicts with an existing known kind (i.e., it is 3157 signed by a different signer), then it should be rejected with 3158 "Error_Forbidden". This should not happen in correctly functioning 3159 overlays. 3161 If the update is acceptable, then the node MUST reconfigure itself to 3162 match the new information. This may include adding permissions for 3163 new kinds, deleting old kinds, or even, in extreme circumstances, 3164 exiting and reentering the overlay, if, for instance, the DHT 3165 algorithm has changed. 3167 The response for Config_Update is empty. 3169 5.6. Overlay Link Layer 3171 RELOAD can use multiple Overlay Link protocols to send its messages. 3172 Because ICE is used to establish connections (see Section 5.5.1.3), 3173 RELOAD nodes are able to detect which Overlay Link protocols are 3174 offered by other nodes and establish connections between them. Any 3175 link protocol needs to be able to establish a secure, authenticated 3176 connection and to provide data origin authentication and message 3177 integrity for individual data elements. RELOAD currently supports 3178 three Overlay Link protocols: 3180 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3181 o TLS [RFC5246] over TCP with Framing Header, no ICE 3182 o DTLS [RFC4347] over UDP with SR, no ICE 3184 Note that although UDP does not properly have "connections", both TLS 3185 and DTLS have a handshake which establishes a similar, stateful 3186 association, and we simply refer to these as "connections" for the 3187 purposes of this document. 3189 If a peer receives a message that is larger than value of max- 3190 message-size defined in the overlay configuration, the peer SHOULD 3191 send an Error_Message_Too_Large error and then close the TLS or DTLS 3192 session from which the message was received. Note that this error 3193 can be sent and the session closed before receiving the complete 3194 message. If the forwarding header is larger than the max-message- 3195 size, the receiver SHOULD close the TLS or DTLS session without 3196 sending an error. 3198 The Framing Header (FH) is used to frame messages and provide timing 3199 when used on a reliable stream-based transport protocol. Simple 3200 Reliability (SR) makes use of the FH to provide congestion control 3201 and semi-reliability when using unreliable message-oriented transport 3202 protocols. We will first define each of these algorithms, then 3203 define overlay link protocols that use them. 3205 Note: We expect future Overlay Link protocols to define replacements 3206 for all components of these protocols, including the framing header. 3207 These protocols have been chosen for simplicity of implementation and 3208 reasonable performance. 3210 Note to implementers: There are inherent tradeoffs in utilizing 3211 short timeouts to determine when a link has failed. To balance the 3212 tradeoffs, an implementation should be able to quickly act to remove 3213 entries from the routing table when there is reason to suspect the 3214 link has failed. For example, in a Chord-derived overlay algorithm, 3215 a closer finger table entry could be substituted for an entry in the 3216 finger table that has experienced a timeout. That entry can be 3217 restored if it proves to resume functioning, or replaced at some 3218 point in the future if necessary. End-to-end retransmissions will 3219 handle any lost messages, but only if the failing entries do not 3220 remain in the finger table for subsequent retransmissions. 3222 5.6.1. Future Overlay Link Protocols 3224 5.6.1.1. HIP 3226 The P2PSIP Working Group has expressed interest in supporting a HIP- 3227 based link protocol [RFC5201]. Such support would require specifying 3228 such details as: 3230 o How to issue certificates which provided identities meaningful to 3231 the HIP base exchange. We anticipate that this would require a 3232 mapping between ORCHIDs and NodeIds. 3233 o How to carry the HIP I1 and I2 messages. We anticipate that this 3234 would require defining a HIP Tunnel usage. 3235 o How to carry RELOAD messages over HIP. 3237 5.6.1.2. ICE-TCP 3239 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] should allow TCP to be 3240 supported as an Overlay Link protocol that can be added using ICE. 3241 However, as of the time of this writing, the draft is not making 3242 significant progress toward approval. 3244 5.6.1.3. Message-oriented Transports 3246 Modern message-oriented transports offer high performance, good 3247 congestion control, and avoid head-of-line blocking in case of lost 3248 data. These characteristics make them preferable as underlying 3249 transport protocols for RELOAD links. SCTP without message ordering 3250 and DCCP are two examples of such protocols. However, currently they 3251 are not well-supported by commonly available NATs, and specifications 3252 for ICE session establishment are not available. 3254 5.6.1.4. Tunneled Transports 3256 As of the time of this writing, there is significant interest in the 3257 IETF community in tunneling other transports over UDP, motivated by 3258 the situation that UDP is well-supported by modern NAT hardware, and 3259 similar performance can be achieved to native implementation. 3260 Currently SCTP, DCCP, and a generic tunneling extension are being 3261 proposed for message-oriented protocols. Baset et al. have proposed 3262 tunneling TCP over UDP for similar reasons 3263 [I-D.baset-tsvwg-tcp-over-udp]. Once ICE traversal has been 3264 specified for these tunneled protocols, they should be easily 3265 supported as an overlay link protocol. 3267 5.6.2. Framing Header 3269 In order to support unreliable links and to allow for quick detection 3270 of link failures when using reliable end-to-end transports, each 3271 message is wrapped in a very simple framing layer (FramedMessage) 3272 which is only used for each hop. This layer contains a sequence 3273 number which can then be used for ACKs. The same header is used for 3274 both reliable and unreliable transports for simplicity of 3275 implementation---not all aspects of the header apply to both types of 3276 transports. 3278 The definition of FramedMessage is: 3280 enum {data (128), ack (129), (255)} FramedMessageType; 3282 struct { 3283 FramedMessageType type; 3285 select (type) { 3286 case data: 3287 uint32 sequence; 3288 opaque message<0..2^24-1>; 3290 case ack: 3291 uint32 ack_sequence; 3292 uint32 received; 3293 }; 3294 } FramedMessage; 3296 The type field of the PDU is set to indicate whether the message is 3297 data or an acknowledgement. 3299 If the message is of type "data", then the remainder of the PDU is as 3300 follows: 3302 sequence 3303 the sequence number. This increments by 1 for each framed message 3304 sent over this transport session. 3306 message 3307 the message that is being transmitted. 3309 Each connection has it own sequence number space. Initially the 3310 value is zero and it increments by exactly one for each message sent 3311 over that connection. 3313 When the receiver receives a message, it SHOULD immediately send an 3314 ACK message. The receiver MUST keep track of the 32 most recent 3315 sequence numbers received on this association in order to generate 3316 the appropriate ack. 3318 If the PDU is of type "ack", the contents are as follows: 3320 ack_sequence 3321 The sequence number of the message being acknowledged. 3323 received 3324 A bitmask indicating if each of the previous 32 sequence numbers 3325 before this packet has been among the 32 packets most recently 3326 received on this connection. When a packet is received with a 3327 sequence number N, the receiver looks at the sequence number of 3328 the previously 32 packets received on this connection. Call the 3329 previously received packet number M. For each of the previous 32 3330 packets, if the sequence number M is less than N but greater than 3331 N-32, the N-M bit of the received bitmask is set to one; otherwise 3332 it is zero. Note that a bit being set to one indicates positively 3333 that a particular packet was received, but a bit being set to zero 3334 means only that it is unknown whether or not the packet has been 3335 received, because it might have been received before the 32 most 3336 recently received packets. 3338 The received field bits in the ACK provide a very high degree of 3339 redundancy so that the sender can figure out which packets the 3340 receiver has received and can then estimate packet loss rates. If 3341 the sender also keeps track of the time at which recent sequence 3342 numbers have been sent, the RTT can be estimated. 3344 5.6.3. Simple Reliability 3346 When RELOAD is carried over DTLS or another unreliable link protocol, 3347 it needs to be used with a reliability and congestion control 3348 mechanism, which is provided on a hop-by-hop basis. The basic 3349 principle is that each message, regardless of whether or not it 3350 carries a request or response, will get an ACK and be reliably 3351 retransmitted. The receiver's job is very simple, limited to just 3352 sending ACKs. All the complexity is at the sender side. This allows 3353 the sending implementation to trade off performance versus 3354 implementation complexity without affecting the wire protocol. 3356 5.6.3.1. Retransmission and Flow Control 3358 Because the receiver's role is limited to providing packet 3359 acknowledgements, a wide variety of congestion control algorithms can 3360 be implemented on the sender side while using the same basic wire 3361 protocol. Senders MUST implement a retransmission and congestion 3362 control scheme no more aggressive then TFRC[RFC5348]. One way to do 3363 that is for senders to implement the scheme in the following section. 3364 Another alternative would be TFRC-SP [RFC4828] and use the received 3365 bitmask to allow the sender to compute packet loss event rates. 3367 5.6.3.1.1. Trivial Retransmission 3369 A peer SHOULD retransmit a message if it has not received an ACK 3370 after an interval of RTO ("Retransmission TimeOut"). The peer MUST 3371 double the time to wait after each retransmission. In each 3372 retransmission, the sequence number is incremented. 3374 The RTO is an estimate of the round-trip time (RTT). Implementations 3375 can use a static value for RTO or a dynamic estimate which will 3376 result in better performance. For implementations that use a static 3377 value, the default value for RTO is 500 ms. Nodes MAY use smaller 3378 values of RTO if it is known that all nodes are are within the local 3379 network. The default RTO MAY be chosen larger, and this is 3380 RECOMMENDED if it is known in advance (such as on high latency access 3381 links) that the round-trip time is larger. 3383 Implementations that use a dynamic estimate to compute the RTO MUST 3384 use the algorithm described in RFC 2988[RFC2988], with the exception 3385 that the value of RTO SHOULD NOT be rounded up to the nearest second 3386 but instead rounded up to the nearest millisecond. The RTT of a 3387 successful STUN transaction from the ICE stage is used as the initial 3388 measurement for formula 2.2 of RFC 2988. The sender keeps track of 3389 the time each message was sent for all recently sent messages. Any 3390 time an ACK is received, the sender can compute the RTT for that 3391 message by looking at the time the ACK was received and the time when 3392 the message was sent. This is used as a subsequent RTT measurement 3393 for formula 2.3 of RFC 2988 to update the RTO estimate. (Note that 3394 because retransmissions receive new sequence numbers, all received 3395 ACKs are used.) 3397 The value for RTO is calculated separately for each DTLS session. 3399 Retransmissions continue until a response is received, or until a 3400 total of 5 requests have been sent or there has been a hard ICMP 3401 error [RFC1122]. The sender knows a response was received when it 3402 receives an ACK with a sequence number that indicates it is a 3403 response to one of the transmissions of this messages. For example, 3404 assuming an RTO of 500 ms, requests would be sent at times 0 ms, 500 3405 ms, 1500 ms, 3500 ms, and 7500 ms. If all retransmissions for a 3406 message fail, then the sending node SHOULD close the connection 3407 routing the message. 3409 To determine when a link may be failing without waiting for the final 3410 timeout, observe when no ACKs have been received for an entire RTO 3411 interval, and then wait for three retransmissions to occur beyond 3412 that point. If no ACKs have been received by the time the third 3413 retransmission occurs, it is RECOMMENDED that the link be removed 3414 from the routing table. The link MAY be restored to the routing 3415 table if ACKs resume before the connection is closed, as described 3416 above. 3418 Once an ACK has been received for a message, the next message can be 3419 sent, but the peer SHOULD ensure that there is at least 10 ms between 3420 sending any two messages. The only time a value less than 10 ms can 3421 be used is when it is known that all nodes are on a network that can 3422 support retransmissions faster than 10 ms with no congestion issues. 3424 5.6.4. DTLS/UDP with SR 3426 This overlay link protocol consists of DTLS over UDP while 3427 implementing the Simple Reliability protocol. STUN Connectivity 3428 checks and keepalives are used. 3430 5.6.5. TLS/TCP with FH, no ICE 3432 This overlay link protocol consists of TLS over TCP with the framing 3433 header. Because ICE is not used, STUN connectivity checks are not 3434 used upon establishing the TCP connection, nor are they used for 3435 keepalives. 3437 Because the TCP layer's application-level timeout is too slow to be 3438 useful for overlay routing, the Overlay Link implementation MUST 3439 using the framing header to measure the RTT of the connection and 3440 calculate an RTO as specified in Section 2 of [RFC2988]. The 3441 resulting RTO is not used for retransmissions, but as a timeout to 3442 indicate when the link SHOULD be removed from the routing table. It 3443 is RECOMMENDED that such a connection be retained for 30s to 3444 determine if the failure was transient before concluding the link has 3445 failed permanently. 3447 When sending candidates for TLS/TCP with FH, no ICE, a passive 3448 candidate MUST be provided. The following table shows which side of 3449 the exchange initiates the connection depending on whether they 3450 provided ICE or No-ICE candidates. Note that the active TCP role 3451 does not alter the TLS server/client determination. 3453 +----------------------+----------+-----------------+ 3454 | Offeror | Answerer | TCP Active Role | 3455 +----------------------+----------+-----------------+ 3456 | ICE | No-ICE | Offeror | 3457 | No-ICE | ICE | Answerer | 3458 | No-ICE | No-ICE | Offeror | 3459 +----------------------+----------+-----------------+ 3461 Table 1: Determining Active Role for No-ICE 3463 5.6.6. DTLS/UDP with SR, no ICE 3465 This overlay link protocol consists of DTLS over UDP while 3466 implementing the Simple Reliability protocol. Because ICE is not 3467 used, no STUN connectivity checks or keepalives are used. 3469 5.7. Fragmentation and Reassembly 3471 In order to allow transmission over datagram protocols such as DTLS, 3472 RELOAD messages may be fragmented. 3474 Any node along the path can fragment the message but only the final 3475 destination reassembles the fragments. When a node takes a packet 3476 and fragments it, each fragment has a full copy of the Forwarding 3477 Header but the data after the Forwarding Header is broken up in 3478 appropriate sized chunks. The size of the payload chunks needs to 3479 take into account space to allow the via and destination lists to 3480 grow. Each fragment MUST contain a full copy of the via and 3481 destination list and MUST contain at least 256 bytes of the message 3482 body. If the via and destination list are so large that this is not 3483 possible, RELOAD fragmentation is not performed and IP-layer 3484 fragmentation is allowed to occur. When a message must be 3485 fragmented, it SHOULD be split into equal-sized fragments that are no 3486 larger than the PMTU of the next overlay link minus 32 bytes. This 3487 is to allow the via list to grow before further fragmentation is 3488 required. 3490 Note that this fragmentation is not optimal for the end-to-end path - 3491 a message may be refragmented multiple times as it traverses the 3492 overlay. This option has been chosen as it is far easier to 3493 implement than e2e PMTU discovery across an ever-changing overlay, 3494 and it effectively addresses the reliability issues of relying on IP- 3495 layer fragmentation. However, PING can be used to allow e2e PMTU to 3496 be implemented if desired. 3498 Upon receipt of a fragmented message by the intended peer, the peer 3499 holds the fragments in a holding buffer until the entire message has 3500 been received. The message is then reassembled into a single message 3501 and processed. In order to mitigate denial of service attacks, 3502 receivers SHOULD time out incomplete fragments after maximum request 3503 lifetime (15 seconds). Note this time was derived from looking at 3504 the end to end retransmission time and saving fragments long enough 3505 for the full end to end retransmissions to take place. Ideally the 3506 receiver would have enough buffer space to deal with as many 3507 fragments as can arrive in the maximum request lifetime. However, if 3508 the receiver runs out of buffer space to reassemble the messages it 3509 MUST drop the message. 3511 When a message is fragmented, the fragment offset value is stored in 3512 the lower 24 bits of the fragment field of the forwarding header. 3513 The offset is the number of bytes between the end of the forwarding 3514 header and the start of the data. The first fragment therefore has 3515 an offset of 0. The first and last bit indicators MUST be 3516 appropriately set. If the message is not fragmented, then both the 3517 first and last fragment are set to 1 and the offset is 0 resulting in 3518 a fragment value of 0xC0000000. 3520 6. Data Storage Protocol 3522 RELOAD provides a set of generic mechanisms for storing and 3523 retrieving data in the Overlay Instance. These mechanisms can be 3524 used for new applications simply by defining new code points and a 3525 small set of rules. No new protocol mechanisms are required. 3527 The basic unit of stored data is a single StoredData structure: 3529 struct { 3530 uint32 length; 3531 uint64 storage_time; 3532 uint32 lifetime; 3533 StoredDataValue value; 3534 Signature signature; 3535 } StoredData; 3537 The contents of this structure are as follows: 3539 length 3540 The size of the StoredData structure in octets excluding the size 3541 of length itself. 3543 storage_time 3544 The time when the data was stored in absolute time, represented in 3545 milliseconds since the Unix epoch of midnight Jan 1, 1970. Any 3546 attempt to store a data value with a storage time before that of a 3547 value already stored at this location MUST generate a 3548 Error_Data_Too_Old error. This prevents rollback attacks. Note 3549 that this does not require synchronized clocks: the receiving 3550 peer uses the storage time in the previous store, not its own 3551 clock. 3552 A node that is attempting to store new data in response to a user 3553 request (rather than as an overlay maintenance operation such as 3554 occurs during unpartitioning) is rejected with an 3555 Error_Data_Too_Old error, the node MAY elect to perform its store 3556 using a storage_time that increments the value used with the 3557 previous store. This situation may occur when the clocks of nodes 3558 storing to this location are not properly synchronized. 3560 lifetime 3561 The validity period for the data, in seconds, starting from the 3562 time of store. 3564 value 3565 The data value itself, as described in Section 6.2. 3567 signature 3568 A signature as defined in Section 6.1. 3570 Each Resource-ID specifies a single location in the Overlay Instance. 3571 However, each location may contain multiple StoredData values 3572 distinguished by Kind-ID. The definition of a kind describes both 3573 the data values which may be stored and the data model of the data. 3574 Some data models allow multiple values to be stored under the same 3575 Kind-ID. Section Section 6.2 describes the available data models. 3576 Thus, for instance, a given Resource-ID might contain a single-value 3577 element stored under Kind-ID X and an array containing multiple 3578 values stored under Kind-ID Y. 3580 6.1. Data Signature Computation 3582 Each StoredData element is individually signed. However, the 3583 signature also must be self-contained and cover the Kind-ID and 3584 Resource-ID even though they are not present in the StoredData 3585 structure. The input to the signature algorithm is: 3587 resource_id + kind + storage_time + StoredDataValue + 3588 SignerIdentity 3590 Where these values are: 3592 resource 3593 The resource ID where this data is stored. 3595 kind 3596 The Kind-ID for this data. 3598 storage_time 3599 The contents of the storage_time data value. 3600 StoredDataValue 3601 The contents of the stored data value, as described in the 3602 previous sections. 3604 SignerIdentity 3605 The signer identity as defined in Section 5.3.4. 3607 Once the signature has been computed, the signature is represented 3608 using a signature element, as described in Section 5.3.4. 3610 6.2. Data Models 3612 The protocol currently defines the following data models: 3614 o single value 3615 o array 3616 o dictionary 3618 These are represented with the StoredDataValue structure: 3620 enum { reserved(0), single_value(1), array(2), 3621 dictionary(3), (255)} DataModel; 3623 struct { 3624 Boolean exists; 3625 opaque value<0..2^32-1>; 3626 } DataValue; 3628 struct { 3629 select (DataModel) { 3630 case single_value: 3631 DataValue single_value_entry; 3633 case array: 3634 ArrayEntry array_entry; 3636 case dictionary: 3637 DictionaryEntry dictionary_entry; 3639 /* This structure may be extended */ 3640 } ; 3641 } StoredDataValue; 3643 We now discuss the properties of each data model in turn: 3645 6.2.1. Single Value 3647 A single-value element is a simple sequence of bytes. There may be 3648 only one single-value element for each Resource-ID, Kind-ID pair. 3650 A single value element is represented as a DataValue, which contains 3651 the following two elements: 3653 exists 3654 This value indicates whether the value exists at all. If it is 3655 set to False, it means that no value is present. If it is True, 3656 that means that a value is present. This gives the protocol a 3657 mechanism for indicating nonexistence as opposed to emptiness. 3659 value 3660 The stored data. 3662 6.2.2. Array 3664 An array is a set of opaque values addressed by an integer index. 3665 Arrays are zero based. Note that arrays can be sparse. For 3666 instance, a Store of "X" at index 2 in an empty array produces an 3667 array with the values [ NA, NA, "X"]. Future attempts to fetch 3668 elements at index 0 or 1 will return values with "exists" set to 3669 False. 3671 A array element is represented as an ArrayEntry: 3673 struct { 3674 uint32 index; 3675 DataValue value; 3676 } ArrayEntry; 3678 The contents of this structure are: 3680 index 3681 The index of the data element in the array. 3683 value 3684 The stored data. 3686 6.2.3. Dictionary 3688 A dictionary is a set of opaque values indexed by an opaque key with 3689 one value for each key. A single dictionary entry is represented as 3690 follows: 3692 A dictionary element is represented as a DictionaryEntry: 3694 typedef opaque DictionaryKey<0..2^16-1>; 3696 struct { 3697 DictionaryKey key; 3698 DataValue value; 3699 } DictionaryEntry; 3701 The contents of this structure are: 3703 key 3704 The dictionary key for this value. 3706 value 3707 The stored data. 3709 6.3. Access Control Policies 3711 Every kind which is storable in an overlay MUST be associated with an 3712 access control policy. This policy defines whether a request from a 3713 given node to operate on a given value should succeed or fail. It is 3714 anticipated that only a small number of generic access control 3715 policies are required. To that end, this section describes a small 3716 set of such policies and Section 13.3 establishes a registry for new 3717 policies if required. Each policy has a short string identifier 3718 which is used to reference it in the configuration document. 3720 6.3.1. USER-MATCH 3722 In the USER-MATCH policy, a given value MUST be written (or 3723 overwritten) if and only if the request is signed with a key 3724 associated with a certificate whose user name hashes (using the hash 3725 function for the overlay) to the Resource-ID for the resource. 3726 Recall that the certificate may, depending on the overlay 3727 configuration, be self-signed. 3729 6.3.2. NODE-MATCH 3731 In the NODE-MATCH policy, a given value MUST be written (or 3732 overwritten) if and only if the request is signed with a key 3733 associated with a certificate whose Node-ID hashes (using the hash 3734 function for the overlay) to the Resource-ID for the resource. 3736 6.3.3. USER-NODE-MATCH 3738 The USER-NODE-MATCH policy may only be used with dictionary types. 3739 In the USER-NODE-MATCH policy, a given value MUST be written (or 3740 overwritten) if and only if the request is signed with a key 3741 associated with a certificate whose user name hashes (using the hash 3742 function for the overlay) to the Resource-ID for the resource. In 3743 addition, the dictionary key MUST be equal to the Node-ID in the 3744 certificate. 3746 6.3.4. NODE-MULTIPLE 3748 In the NODE-MULTIPLE policy, a given value MUST be written (or 3749 overwritten) if and only if the request is signed with a key 3750 associated with a certificate containing a Node-ID such that 3751 H(Node-ID || i) is equal to the Resource-ID for some small integer 3752 value of i. When this policy is in use, the maximum value of i MUST 3753 be specified in the kind definition. 3755 6.4. Data Storage Methods 3757 RELOAD provides several methods for storing and retrieving data: 3759 o Store values in the overlay 3760 o Fetch values from the overlay 3761 o Stat: get metadata about values in the overlay 3762 o Find the values stored at an individual peer 3764 These methods are each described in the following sections. 3766 6.4.1. Store 3768 The Store method is used to store data in the overlay. The format of 3769 the Store request depends on the data model which is determined by 3770 the kind. 3772 6.4.1.1. Request Definition 3774 A StoreReq message is a sequence of StoreKindData values, each of 3775 which represents a sequence of stored values for a given kind. The 3776 same Kind-ID MUST NOT be used twice in a given store request. Each 3777 value is then processed in turn. These operations MUST be atomic. 3778 If any operation fails, the state MUST be rolled back to before the 3779 request was received. 3781 The store request is defined by the StoreReq structure: 3783 struct { 3784 KindId kind; 3785 uint64 generation_counter; 3786 StoredData values<0..2^32-1>; 3787 } StoreKindData; 3789 struct { 3790 ResourceId resource; 3791 uint8 replica_number; 3792 StoreKindData kind_data<0..2^32-1>; 3793 } StoreReq; 3795 A single Store request stores data of a number of kinds to a single 3796 resource location. The contents of the structure are: 3798 resource 3799 The resource to store at. 3801 replica_number 3802 The number of this replica. When a storing peer saves replicas to 3803 other peers each peer is assigned a replica number starting from 1 3804 and sent in the Store message. This field is set to 0 when a node 3805 is storing its own data. This allows peers to distinguish replica 3806 writes from original writes. 3808 kind_data 3809 A series of elements, one for each kind of data to be stored. 3811 If the replica number is zero, then the peer MUST check that it is 3812 responsible for the resource and, if not, reject the request. If the 3813 replica number is nonzero, then the peer MUST check that it expects 3814 to be a replica for the resource and that the request sender is 3815 consistent with being the responsible node (i.e., that the receiving 3816 peer does not know of a better node) and, if not, reject the request. 3818 Each StoreKindData element represents the data to be stored for a 3819 single Kind-ID. The contents of the element are: 3821 kind 3822 The Kind-ID. Implementations SHOULD reject requests corresponding 3823 to unknown kinds unless specifically configured otherwise. 3825 generation 3826 The expected current state of the generation counter 3827 (approximately the number of times this object has been written; 3828 see below for details). 3830 values 3831 The value or values to be stored. This may contain one or more 3832 stored_data values depending on the data model associated with 3833 each kind. 3835 The peer MUST perform the following checks: 3837 o The kind_id is known and supported. 3838 o The signatures over each individual data element (if any) are 3839 valid. If this check fails, the request MUST be rejected with an 3840 Error_Forbidden error. 3841 o Each element is signed by a credential which is authorized to 3842 write this kind at this Resource-ID. If this check fails, the 3843 request MUST be rejected with an Error_Forbidden error. 3845 o For original (non-replica) stores, the peer MUST check that if the 3846 generation-counter is non-zero, it equals the current value of the 3847 generation-counter for this kind. This feature allows the 3848 generation counter to be used in a way similar to the HTTP Etag 3849 feature. 3850 o The storage time values are greater than that of any value which 3851 would be replaced by this Store. 3852 o The size and number of the stored values is consistent with the 3853 limits specified in the overlay configuration. 3855 If all these checks succeed, the peer MUST attempt to store the data 3856 values. For non-replica stores, if the store succeeds and the data 3857 is changed, then the peer must increase the generation counter by at 3858 least one. If there are multiple stored values in a single 3859 StoreKindData, it is permissible for the peer to increase the 3860 generation counter by only 1 for the entire Kind-ID, or by 1 or more 3861 than one for each value. Accordingly, all stored data values must 3862 have a generation counter of 1 or greater. 0 is used in the Store 3863 request to indicate that the generation counter should be ignored for 3864 processing this request; however the responsible peer should increase 3865 the stored generation counter and should return the correct 3866 generation counter in the response. 3868 For replica Stores, the peer MUST set the generation counter to match 3869 the generation_counter in the message, and MUST NOT check the 3870 generation counter against the current value. Replica Stores MUST 3871 NOT use a generation counter of 0. 3873 When a peer stores data previously stored by another node (e.g., for 3874 replicas or topology shifts) it MUST adjust the lifetime value 3875 downward to reflect the amount of time the value was stored at the 3876 peer. 3878 Unless otherwise specified by the usage, if a peer attempts to store 3879 data previously stored by another node (e.g., for replicas or 3880 topology shifts) and that store fails with either an 3881 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 3882 peer MUST fetch the newer data from the the peer generating the error 3883 and use that to replace its own copy. This rule allows 3884 resynchronization after partitions heal. 3886 The properties of stores for each data model are as follows: 3888 Single-value: 3890 A store of a new single-value element creates the element if it 3891 does not exist and overwrites any existing value with the new 3892 value. 3894 Array: 3895 A store of an array entry replaces (or inserts) the given value at 3896 the location specified by the index. Because arrays are sparse, a 3897 store past the end of the array extends it with nonexistent values 3898 (exists=False) as required. A store at index 0xffffffff places 3899 the new value at the end of the array regardless of the length of 3900 the array. The resulting StoredData has the correct index value 3901 when it is subsequently fetched. 3903 Dictionary: 3904 A store of a dictionary entry replaces (or inserts) the given 3905 value at the location specified by the dictionary key. 3907 The following figure shows the relationship between these structures 3908 for an example store which stores the following values at resource 3909 "1234" 3911 o The value "abc" in the single value location for kind X 3912 o The value "foo" at index 0 in the array for kind Y 3913 o The value "bar" at index 1 in the array for kind Y 3914 Store 3915 resource=1234 3916 replica_number = 0 3917 / \ 3918 / \ 3919 StoreKindData StoreKindData 3920 kind=X (Single-Value) kind=Y (Array) 3921 generation_counter = 99 generation_counter = 107 3922 | /\ 3923 | / \ 3924 StoredData / \ 3925 storage_time = xxxxxxx / \ 3926 lifetime = 86400 / \ 3927 signature = XXXX / \ 3928 | | | 3929 | StoredData StoredData 3930 | storage_time = storage_time = 3931 | yyyyyyyy zzzzzzz 3932 | lifetime = 86400 lifetime = 33200 3933 | signature = YYYY signature = ZZZZ 3934 | | | 3935 StoredDataValue | | 3936 value="abc" | | 3937 | | 3938 StoredDataValue StoredDataValue 3939 index=0 index=1 3940 value="foo" value="bar" 3942 6.4.1.2. Response Definition 3944 In response to a successful Store request the peer MUST return a 3945 StoreAns message containing a series of StoreKindResponse elements 3946 containing the current value of the generation counter for each 3947 Kind-ID, as well as a list of the peers where the data will be 3948 replicated. 3950 struct { 3951 KindId kind; 3952 uint64 generation_counter; 3953 NodeId replicas<0..2^16-1>; 3954 } StoreKindResponse; 3956 struct { 3957 StoreKindResponse kind_responses<0..2^16-1>; 3958 } StoreAns; 3960 The contents of each StoreKindResponse are: 3962 kind 3963 The Kind-ID being represented. 3965 generation 3966 The current value of the generation counter for that Kind-ID. 3968 replicas 3969 The list of other peers at which the data was/will be replicated. 3970 In overlays and applications where the responsible peer is 3971 intended to store redundant copies, this allows the storing peer 3972 to independently verify that the replicas have in fact been 3973 stored. It does this verification by using the Stat method. Note 3974 that the storing peer is not require to perform this verification. 3976 The response itself is just StoreKindResponse values packed end-to- 3977 end. 3979 If any of the generation counters in the request precede the 3980 corresponding stored generation counter, then the peer MUST fail the 3981 entire request and respond with an Error_Generation_Counter_Too_Low 3982 error. The error_info in the ErrorResponse MUST be a StoreAns 3983 response containing the correct generation counter for each kind and 3984 the replica list, which will be empty. For original (non-replica) 3985 stores, a node which receives such an error SHOULD attempt to fetch 3986 the data and, if the storage_time value is newer, replace its own 3987 data with that newer data. This rule improves data consistency in 3988 the case of partitions and merges. 3990 If the data being stored is too large for the allowed limit by the 3991 given usage, then the peer MUST fail the request and generate an 3992 Error_Data_Too_Large error. 3994 If any type of request tries to access a data kind that the node does 3995 not know about, an Error_Unknown_Kind MUST be generated. The 3996 error_info in the Error_Response is: 3998 KindId unknown_kinds<2^8-1>; 4000 which lists all the kinds that were unrecognized. 4002 6.4.1.3. Removing Values 4004 This version of RELOAD (unlike previous versions) does not have an 4005 explicit Remove operation. Rather, values are Removed by storing 4006 "nonexistent" values in their place. Each DataValue contains a 4007 boolean value called "exists" which indicates whether a value is 4008 present at that location. In order to effectively remove a value, 4009 the owner stores a new DataValue with: 4011 exists = false 4012 value = {} (0 length) 4014 Storing nodes MUST treat these nonexistent values the same way they 4015 treat any other stored value, including overwriting the existing 4016 value, replicating them, and aging them out as necessary when 4017 lifetime expires. When a stored nonexistent value's lifetime 4018 expires, it is simply removed from the storing node like any other 4019 stored value expiration. Note that in the case of arrays and 4020 dictionaries, this may create an implicit, unsigned "nonexistent" 4021 value to represent a gap in the data structure. However, this value 4022 isn't persistent nor is it replicated. It is simply synthesized by 4023 the storing node. 4025 6.4.2. Fetch 4027 The Fetch request retrieves one or more data elements stored at a 4028 given Resource-ID. A single Fetch request can retrieve multiple 4029 different kinds. 4031 6.4.2.1. Request Definition 4033 struct { 4034 int32 first; 4035 int32 last; 4036 } ArrayRange; 4038 struct { 4039 KindId kind; 4040 uint64 generation; 4041 uint16 length; 4043 select (model) { 4044 case single_value: ; /* Empty */ 4046 case array: 4047 ArrayRange indices<0..2^16-1>; 4049 case dictionary: 4050 DictionaryKey keys<0..2^16-1>; 4052 /* This structure may be extended */ 4054 } model_specifier; 4055 } StoredDataSpecifier; 4057 struct { 4058 ResourceId resource; 4059 StoredDataSpecifier specifiers<0..2^16-1>; 4060 } FetchReq; 4062 The contents of the Fetch requests are as follows: 4064 resource 4065 The resource ID to fetch from. 4067 specifiers 4068 A sequence of StoredDataSpecifier values, each specifying some of 4069 the data values to retrieve. 4071 Each StoredDataSpecifier specifies a single kind of data to retrieve 4072 and (if appropriate) the subset of values that are to be retrieved. 4073 The contents of the StoredDataSpecifier structure are as follows: 4075 kind 4076 The Kind-ID of the data being fetched. Implementations SHOULD 4077 reject requests corresponding to unknown kinds unless specifically 4078 configured otherwise. 4080 model 4081 The data model of the data. This must be checked against the 4082 Kind-ID. 4084 generation 4085 The last generation counter that the requesting node saw. This 4086 may be used to avoid unnecessary fetches or it may be set to zero. 4088 length 4089 The length of the rest of the structure, thus allowing 4090 extensibility. 4092 model_specifier 4093 A reference to the data value being requested within the data 4094 model specified for the kind. For instance, if the data model is 4095 "array", it might specify some subset of the values. 4097 The model_specifier is as follows: 4099 o If the data model is single value, the specifier is empty. 4100 o If the data model is array, the specifier contains a list of 4101 ArrayRange elements, each of which contains two integers. The 4102 first integer is the beginning of the range and the second is the 4103 end of the range. 0 is used to indicate the first element and 4104 0xffffffff is used to indicate the final element. The first 4105 integer must be less than the second. The ranges MUST NOT 4106 overlap. 4107 o If the data model is dictionary then the specifier contains a list 4108 of the dictionary keys being requested. If no keys are specified, 4109 than this is a wildcard fetch and all key-value pairs are 4110 returned. 4112 The generation-counter is used to indicate the requester's expected 4113 state of the storing peer. If the generation-counter in the request 4114 matches the stored counter, then the storing peer returns a response 4115 with no StoredData values. 4117 Note that because the certificate for a user is typically stored at 4118 the same location as any data stored for that user, a requesting node 4119 that does not already have the user's certificate should request the 4120 certificate in the Fetch as an optimization. 4122 6.4.2.2. Response Definition 4124 The response to a successful Fetch request is a FetchAns message 4125 containing the data requested by the requester. 4127 struct { 4128 KindId kind; 4129 uint64 generation; 4130 StoredData values<0..2^32-1>; 4131 } FetchKindResponse; 4133 struct { 4134 FetchKindResponse kind_responses<0..2^32-1>; 4135 } FetchAns; 4137 The FetchAns structure contains a series of FetchKindResponse 4138 structures. There MUST be one FetchKindResponse element for each 4139 Kind-ID in the request. 4141 The contents of the FetchKindResponse structure are as follows: 4143 kind 4144 the kind that this structure is for. 4146 generation 4147 the generation counter for this kind. 4149 values 4150 the relevant values. If the generation counter in the request 4151 matches the generation-counter in the stored data, then no 4152 StoredData values are returned. Otherwise, all relevant data 4153 values MUST be returned. A nonexistent value is represented with 4154 "exists" set to False. 4156 There is one subtle point about signature computation on arrays. If 4157 the storing node uses the append feature (where the 4158 index=0xffffffff), then the index in the StoredData that is returned 4159 will not match that used by the storing node, which would break the 4160 signature. In order to avoid this issue, the index value in the 4161 array is set to zero before the signature is computed. This implies 4162 that malicious storing nodes can reorder array entries without being 4163 detected. 4165 6.4.3. Stat 4167 The Stat request is used to get metadata (length, generation counter, 4168 digest, etc.) for a stored element without retrieving the element 4169 itself. The name is from the UNIX stat(2) system call which performs 4170 a similar function for files in a filesystem. It also allows the 4171 requesting node to get a list of matching elements without requesting 4172 the entire element. 4174 6.4.3.1. Request Definition 4176 The Stat request is identical to the Fetch request. It simply 4177 specifies the elements to get metadata about. 4179 struct { 4180 ResourceId resource; 4181 StoredDataSpecifier specifiers<0..2^16-1>; 4182 } StatReq; 4184 6.4.3.2. Response Definition 4186 The Stat response contains the same sort of entries that a Fetch 4187 response would contain; however, instead of containing the element 4188 data it contains metadata. 4190 struct { 4191 Boolean exists; 4192 uint32 value_length; 4193 HashAlgorithm hash_algorithm; 4194 opaque hash_value<0..255>; 4195 } MetaData; 4197 struct { 4198 uint32 index; 4199 MetaData value; 4200 } ArrayEntryMeta; 4202 struct { 4203 DictionaryKey key; 4204 MetaData value; 4205 } DictionaryEntryMeta; 4207 struct { 4208 select (model) { 4209 case single_value: 4210 MetaData single_value_entry; 4212 case array: 4214 ArrayEntryMeta array_entry; 4216 case dictionary: 4217 DictionaryEntryMeta dictionary_entry; 4219 /* This structure may be extended */ 4220 } ; 4221 } MetaDataValue; 4223 struct { 4224 uint32 value_length; 4225 uint64 storage_time; 4226 uint32 lifetime; 4227 MetaDataValue metadata; 4228 } StoredMetaData; 4230 struct { 4231 KindId kind; 4232 uint64 generation; 4233 StoredMetaData values<0..2^32-1>; 4234 } StatKindResponse; 4236 struct { 4237 StatKindResponse kind_responses<0..2^32-1>; 4238 } StatAns; 4240 The structures used in StatAns parallel those used in FetchAns: a 4241 response consists of multiple StatKindResponse values, one for each 4242 kind that was in the request. The contents of the StatKindResponse 4243 are the same as those in the FetchKindResponse, except that the 4244 values list contains StoredMetaData entries instead of StoredData 4245 entries. 4247 The contents of the StoredMetaData structure are the same as the 4248 corresponding fields in StoredData except that there is no signature 4249 field and the value is a MetaDataValue rather than a StoredDataValue. 4251 A MetaDataValue is a variant structure, like a StoredDataValue, 4252 except for the types of each arm, which replace DataValue with 4253 MetaData. 4255 The only really new structure is MetaData, which has the following 4256 contents: 4258 exists 4259 Same as in DataValue 4261 value_length 4262 The length of the stored value. 4264 hash_algorithm 4265 The hash algorithm used to perform the digest of the value. 4267 hash_value 4268 A digest of the value using hash_algorithm. 4270 6.4.4. Find 4272 The Find request can be used to explore the Overlay Instance. A Find 4273 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4274 (if any) of the resource of kind T known to the target peer which is 4275 closest to R. This method can be used to walk the Overlay Instance by 4276 interactively fetching R_n+1=nearest(1 + R_n). 4278 6.4.4.1. Request Definition 4280 The FindReq message contains a series of Resource-IDs and Kind-IDs 4281 identifying the resource the peer is interested in. 4283 struct { 4284 ResourceId resource; 4285 KindId kinds<0..2^8-1>; 4286 } FindReq; 4288 The request contains a list of Kind-IDs which the Find is for, as 4289 indicated below: 4291 resource 4292 The desired Resource-ID 4294 kinds 4295 The desired Kind-IDs. Each value MUST only appear once. 4297 6.4.4.2. Response Definition 4299 A response to a successful Find request is a FindAns message 4300 containing the closest Resource-ID on the peer for each kind 4301 specified in the request. 4303 struct { 4304 KindId kind; 4305 ResourceId closest; 4306 } FindKindData; 4308 struct { 4309 FindKindData results<0..2^16-1>; 4310 } FindAns; 4312 If the processing peer is not responsible for the specified 4313 Resource-ID, it SHOULD return a 404 RELOAD error code. 4315 For each Kind-ID in the request the response MUST contain a 4316 FindKindData indicating the closest Resource-ID for that Kind-ID, 4317 unless the kind is not allowed to be used with Find in which case a 4318 FindKindData for that Kind-ID MUST NOT be included in the response. 4319 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4320 0. Note that different Kind-IDs may have different closest Resource- 4321 IDs. 4323 The response is simply a series of FindKindData elements, one per 4324 kind, concatenated end-to-end. The contents of each element are: 4326 kind 4327 The Kind-ID. 4329 closest 4330 The closest resource ID to the specified resource ID. This is 0 4331 if no resource ID is known. 4333 Note that the response does not contain the contents of the data 4334 stored at these Resource-IDs. If the requester wants this, it must 4335 retrieve it using Fetch. 4337 6.4.5. Defining New Kinds 4339 There are two ways to define a new kind. The first is by writing a 4340 document and registering the kind-id with IANA. This is the 4341 preferred method for kinds which may be widely used and reused. The 4342 second method is to simply define the kind and its parameters in the 4343 configuration document using the section of kind-id space set aside 4344 for private use. This method MAY be used to define ad hoc kinds in 4345 new overlays. 4347 However a kind is defined, the definition must include: 4349 o The meaning of the data to be stored (in some textual form). 4350 o The Kind-ID. 4351 o The data model (single value, array, dictionary, etc). 4352 o The access control model. 4354 In addition, when kinds are registered with IANA, each kind is 4355 assigned a short string name which is used to refer to it in 4356 configuration documents. 4358 While each kind needs to define what data model is used for its data, 4359 that does not mean that it must define new data models. Where 4360 practical, kinds should use the existing data models. The intention 4361 is that the basic data model set be sufficient for most applications/ 4362 usages. 4364 7. Certificate Store Usage 4366 The Certificate Store usage allows a peer to store its certificate in 4367 the overlay, thus avoiding the need to send a certificate in each 4368 message - a reference may be sent instead. 4370 A user/peer MUST store its certificate at Resource-IDs derived from 4371 two Resource Names: 4373 o The user name in the certificate. 4374 o The Node-ID in the certificate. 4376 Note that in the second case the certificate is not stored at the 4377 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4378 intention here (as is common throughout RELOAD) is to avoid making a 4379 peer responsible for its own data. 4381 A peer MUST ensure that the user's certificates are stored in the 4382 Overlay Instance. New certificates are stored at the end of the 4383 list. This structure allows users to store an old and a new 4384 certificate that both have the same Node-ID, which allows for 4385 migration of certificates when they are renewed. 4387 This usage defines the following kinds: 4389 Name: CERTIFICATE_BY_NODE 4390 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4392 Access Control: NODE-MATCH. 4394 Name: CERTIFICATE_BY_USER 4396 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4398 Access Control: USER-MATCH. 4400 8. TURN Server Usage 4402 The TURN server usage allows a RELOAD peer to advertise that it is 4403 prepared to be a TURN server as defined in [I-D.ietf-behave-turn]. 4404 When a node starts up, it joins the overlay network and forms several 4405 connections in the process. If the ICE stage in any of these 4406 connections returns a reflexive address that is not the same as the 4407 peer's perceived address, then the peer is behind a NAT and not a 4408 candidate for a TURN server. Additionally, if the peer's IP address 4409 is in the private address space range, then it is also not a 4410 candidate for a TURN server. Otherwise, the peer SHOULD assume it is 4411 a potential TURN server and follow the procedures below. 4413 If the node is a candidate for a TURN server it will insert some 4414 pointers in the overlay so that other peers can find it. The overlay 4415 configuration file specifies a turnDensity parameter that indicates 4416 how many times each TURN server should record itself in the overlay. 4417 Typically this should be set to the reciprocal of the estimate of 4418 what percentage of peers will act as TURN servers. For each value, 4419 called d, between 1 and turnDensity, the peer forms a Resource Name 4420 by concatenating its Peer-ID and the value d. This Resource Name is 4421 hashed to form a Resource-ID. The address of the peer is stored at 4422 that Resource-ID using type TURN-SERVICE and the TurnServer object: 4424 struct { 4425 uint8 iteration; 4426 IpAddressAndPort server_address; 4427 } TurnServer; 4429 The contents of this structure are as follows: 4431 iteration 4432 the d value 4434 server_address 4435 the address at which the TURN server can be contacted. 4437 Note: Correct functioning of this algorithm depends critically on 4438 having turnDensity be an accurate estimate of the true density of 4439 TURN servers. If turnDensity is too high, then the process of 4440 finding TURN servers becomes extremely expensive as multiple 4441 candidate Resource-IDs must be probed. 4443 Peers that provide this service need to support the TURN extensions 4444 to STUN for media relay of both UDP and TCP traffic as defined in 4445 [I-D.ietf-behave-turn] and [RFC5382]. 4447 This usage defines the following kind to indicate that a peer is 4448 willing to act as a TURN server: 4450 Name TURN-SERVICE 4451 Data Model The TURN-SERVICE kind stores a single value for each 4452 Resource-ID. 4453 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4455 Peers can find other servers by selecting a random Resource-ID and 4456 then doing a Find request for the appropriate server type with that 4457 Resource-ID. The Find request gets routed to a random peer based on 4458 the Resource-ID. If that peer knows of any servers, they will be 4459 returned. The returned response may be empty if the peer does not 4460 know of any servers, in which case the process gets repeated with 4461 some other random Resource-ID. As long as the ratio of servers 4462 relative to peers is not too low, this approach will result in 4463 finding a server relatively quickly. 4465 9. Chord Algorithm 4467 This algorithm is assigned the name chord-reload to indicate it is an 4468 adaptation of the basic Chord DHT algorithm. 4470 This algorithm differs from the originally presented Chord algorithm 4471 [Chord]. It has been updated based on more recent research results 4472 and implementation experiences, and to adapt it to the RELOAD 4473 protocol. A short list of differences: 4474 o The original Chord algorithm specified that a single predecessor 4475 and a successor list be stored. The chord-reload algorithm 4476 attempts to have more than one predecessor and successor. The 4477 predecessor sets help other neighbors learn their successor list. 4479 o The original Chord specification and analysis called for iterative 4480 routing. RELOAD specifies recursive routing. In addition to the 4481 performance implications, the cost of NAT traversal dictates 4482 recursive routing. 4483 o Finger table entries are indexed in opposite order. Original 4484 Chord specifies finger[0] as the immediate successor of the peer. 4485 chord-reload specifies finger[0] as the peer 180 degrees around 4486 the ring from the peer. This change was made to simplify 4487 discussion and implementation of variable sized finger tables. 4488 However, with either approach no more than O(log N) entries should 4489 typically be stored in a finger table. 4490 o The stabilize() and fix_fingers() algorithms in the original Chord 4491 algorithm are merged into a single periodic process. 4492 Stabilization is implemented slightly differently because of the 4493 larger neighborhood, and fix_fingers is not as aggressive to 4494 reduce load, nor does it search for optimal matches of the finger 4495 table entries. 4496 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4497 not designed to be used in networks with close to or more than 4498 2^128 nodes. 4499 o RELOAD uses randomized finger entries as described in 4500 Section 9.6.4.2. 4501 o This algorithm allows the use of either reactive or periodic 4502 recovery. The original Chord paper used periodic recovery. 4503 Reactive recovery provides better performance in small overlays, 4504 but is believed to be unstable in large (>1000) overlays with high 4505 levels of churn [handling-churn-usenix04]. The overlay 4506 configuration file specifies a "chord-reload-reactive" element 4507 that indicates whether reactive recovery should be used. 4509 9.1. Overview 4511 The algorithm described here is a modified version of the Chord 4512 algorithm. Each peer keeps track of a finger table and a neighbor 4513 table. The neighbor table contains at least the three peers before 4514 and after this peer in the DHT ring. There may not be three entries 4515 in all cases such as small rings or while the ring topology is 4516 changing. The first entry in the finger table contains the peer 4517 half-way around the ring from this peer; the second entry contains 4518 the peer that is 1/4 of the way around; the third entry contains the 4519 peer that is 1/8th of the way around, and so on. Fundamentally, the 4520 chord data structure can be thought of a doubly-linked list formed by 4521 knowing the successors and predecessor peers in the neighbor table, 4522 sorted by the Node-ID. As long as the successor peers are correct, 4523 the DHT will return the correct result. The pointers to the prior 4524 peers are kept to enable the insertion of new peers into the list 4525 structure. Keeping multiple predecessor and successor pointers makes 4526 it possible to maintain the integrity of the data structure even when 4527 consecutive peers simultaneously fail. The finger table forms a skip 4528 list, so that entries in the linked list can be found in O(log(N)) 4529 time instead of the typical O(N) time that a linked list would 4530 provide. 4532 A peer, n, is responsible for a particular Resource-ID k if k is less 4533 than or equal to n and k is greater than p, where p is the peer id of 4534 the previous peer in the neighbor table. Care must be taken when 4535 computing to note that all math is modulo 2^128. 4537 9.2. Routing 4539 The routing table is the union of the neighbor table and the finger 4540 table. 4542 If a peer is not responsible for a Resource-ID k, but is directly 4543 connected to a node with Node-ID k, then it routes the message to 4544 that node. Otherwise, it routes the request to the peer in the 4545 routing table that has the largest Node-ID that is in the interval 4546 between the peer and k. If no such node is found, it finds the 4547 smallest node id that is greater than k and routes the message to 4548 that node. 4550 9.3. Redundancy 4552 When a peer receives a Store request for Resource-ID k, and it is 4553 responsible for Resource-ID k, it stores the data and returns a 4554 success response. It then sends a Store request to its successor in 4555 the neighbor table and to that peer's successor. Note that these 4556 Store requests are addressed to those specific peers, even though the 4557 Resource-ID they are being asked to store is outside the range that 4558 they are responsible for. The peers receiving these check they came 4559 from an appropriate predecessor in their neighbor table and that they 4560 are in a range that this predecessor is responsible for, and then 4561 they store the data. They do not themselves perform further Stores 4562 because they can determine that they are not responsible for the 4563 Resource-ID. 4565 Managing replicas as the overlay changes is described in 4566 Section 9.6.3. 4568 The sequential replicas used in this overlay algorithm protect 4569 against peer failure but not against malicious peers. Additional 4570 replication from the Usage is required to protect resources from such 4571 attacks, as discussed in Section 12.5.4. 4573 9.4. Joining 4575 The join process for a joining party (JP) with Node-ID n is as 4576 follows. 4578 1. JP MUST connect to its chosen bootstrap node. 4579 2. JP SHOULD use a series of Pings to populate its routing table. 4580 3. JP SHOULD send Attach requests to initiate connections to each of 4581 the peers in the neighbor table as well as to the desired finger 4582 table entries. Note that this does not populate their routing 4583 tables, but only their connection tables, so JP will not get 4584 messages that it is expected to route to other nodes. 4585 4. JP MUST enter all the peers it has contacted into its routing 4586 table. 4587 5. JP SHOULD send a Join to its immediate successor, the admitting 4588 peer (AP) for Node-ID n. The AP sends the response to the Join. 4589 6. AP MUST do a series of Store requests to JP to store the data 4590 that JP will be responsible for. 4591 7. AP MUST send JP an Update explicitly labeling JP as its 4592 predecessor. At this point, JP is part of the ring and 4593 responsible for a section of the overlay. AP can now forget any 4594 data which is assigned to JP and not AP. 4595 8. The AP MUST send an Update to all of its neighbors with the new 4596 values of its neighbor set (including JP). 4597 9. The JP MUST send Updates to all the peers in its neighbor table. 4599 In order to populate its neighbor table, JP sends a Ping via the 4600 bootstrap node directed at Resource-ID n+1 (directly after its own 4601 Resource-ID). This allows it to discover its own successor. Call 4602 that node p0. It then sends a ping to p0+1 to discover its successor 4603 (p1). This process can be repeated to discover as many successors as 4604 desired. The values for the two peers before p will be found at a 4605 later stage when n receives an Update. 4607 In order to set up its finger table entry for peer i, JP simply sends 4608 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4609 approximately the right location around the ring. 4611 The joining peer MUST NOT send any Update message placing itself in 4612 the overlay until it has successfully completed an Attach with each 4613 peer that should be in its neighbor table. 4615 9.5. Routing Attaches 4617 When a peer needs to Attach to a new peer in its neighbor table, it 4618 MUST source-route the Attach request through the peer from which it 4619 learned the new peer's Node-ID. Source-routing these requests allows 4620 the overlay to recover from instability. 4622 All other Attach requests, such as those for new finger table 4623 entries, are routed conventionally through the overlay. 4625 9.6. Updates 4627 A chord Update is defined as 4629 enum { reserved (0), 4630 peer_ready(1), neighbors(2), full(3), (255) } 4631 ChordUpdateType; 4633 struct { 4634 uint32 uptime; 4635 ChordUpdateType type; 4636 select(type){ 4637 case peer_ready: /* Empty */ 4638 ; 4640 case neighbors: 4641 NodeId predecessors<0..2^16-1>; 4642 NodeId successors<0..2^16-1>; 4644 case full: 4645 NodeId predecessors<0..2^16-1>; 4646 NodeId successors<0..2^16-1>; 4647 NodeId fingers<0..2^16-1>; 4648 }; 4649 } ChordUpdate; 4651 The "type" field contains the type of the update, which depends on 4652 the reason the update was sent. 4654 uptime: time this peer has been up in seconds. 4656 peer_ready: this peer is ready to receive messages. This message 4657 is used to indicate that a node which has Attached is a peer and 4658 can be routed through. It is also used as a connectivity check to 4659 non-neighbor peers. 4661 neighbors: this version is sent to members of the Chord neighbor 4662 table. 4664 full: this version is sent to peers which request an Update with a 4665 RouteQueryReq. 4667 If the message is of type "neighbors", then the contents of the 4668 message will be: 4670 predecessors 4671 The predecessor set of the Updating peer. 4673 successors 4674 The successor set of the Updating peer. 4676 If the message is of type "full", then the contents of the message 4677 will be: 4679 predecessors 4680 The predecessor set of the Updating peer. 4682 successors 4683 The successor set of the Updating peer. 4685 fingers 4686 The finger table if the Updating peer, in numerically ascending 4687 order. 4689 A peer MUST maintain an association (via Attach) to every member of 4690 its neighbor set. A peer MUST attempt to maintain at least three 4691 predecessors and three successors, even though this will not be 4692 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 4693 predecessors and successors be maintained in the neighbor set. 4695 9.6.1. Handling Neighbor Failures 4697 Every time a connection to a peer in the neighbor table is lost (as 4698 determined by connectivity pings or the failure of some request), the 4699 peer MUST remove the entry from its neighbor table and replace it 4700 with the best match it has from the other peers in its routing table. 4701 If using reactive recovery, it then sends an immediate Update to all 4702 nodes in its Neighbor Table. The update will contain all the Node- 4703 IDs of the current entries of the table (after the failed one has 4704 been removed). Note that when replacing a successor the peer SHOULD 4705 delay the creation of new replicas for successor replacement hold- 4706 down time (30 seconds) after removing the failed entry from its 4707 neighbor table in order to allow a triggered update to inform it of a 4708 better match for its neighbor table. 4710 If the neighbor failure effects the peer's range of responsible IDs, 4711 then the Update MUST be sent to all nodes in its Connection Table. 4713 A peer MAY attempt to reestablish connectivity with a lost neighbor 4714 either by waiting additional time to see if connectivity returns or 4715 by actively routing a new ATTACH to the lost peer. Details for these 4716 procedures are beyond the scope of this document. In no event does 4717 an attempt to reestablish connectivity with a lost neighbor allow the 4718 peer to remain in the neighbor table. Such a peer is returned to the 4719 neighbor table once connectivity is reestablished. 4721 If connectivity is lost to all successor peers in the neighbor table, 4722 then this peer should behave as if it is joining the network and use 4723 Pings to find a peer and send it a Join. If connectivity is lost to 4724 all the peers in the finger table, this peer should assume that it 4725 has been disconnected from the rest of the network, and it should 4726 periodically try to join the DHT. 4728 9.6.2. Handling Finger Table Entry Failure 4730 If a finger table entry is found to have failed, all references to 4731 the failed peer are removed from the finger table and replaced with 4732 the closest preceding peer from the finger table or neighbor table. 4734 If using reactive recovery, the peer initiates a search for a new 4735 finger table entry as described below. 4737 9.6.3. Receiving Updates 4739 When a peer, N, receives an Update request, it examines the Node-IDs 4740 in the UpdateReq and at its neighbor table and decides if this 4741 UpdateReq would change its neighbor table. This is done by taking 4742 the set of peers currently in the neighbor table and comparing them 4743 to the peers in the update request. There are two major cases: 4745 o The UpdateReq contains peers that match N's neighbor table, so no 4746 change is needed to the neighbor set. 4747 o The UpdateReq contains peers N does not know about that should be 4748 in N's neighbor table, i.e. they are closer than entries in the 4749 neighbor table. 4751 In the first case, no change is needed. 4753 In the second case, N MUST attempt to Attach to the new peers and if 4754 it is successful it MUST adjust its neighbor set accordingly. Note 4755 that it can maintain the now inferior peers as neighbors, but it MUST 4756 remember the closer ones. 4758 After any Pings and Attaches are done, if the neighbor table changes 4759 and the peer is using reactive recovery, the peer sends an Update 4760 request to each member of its Connection Table. These Update 4761 requests are what end up filling in the predecessor/successor tables 4762 of peers that this peer is a neighbor to. A peer MUST NOT enter 4763 itself in its successor or predecessor table and instead should leave 4764 the entries empty. 4766 If peer N is responsible for a Resource-ID R, and N discovers that 4767 the replica set for R (the next two nodes in its successor set) has 4768 changed, it MUST send a Store for any data associated with R to any 4769 new node in the replica set. It SHOULD NOT delete data from peers 4770 which have left the replica set. 4772 When a peer N detects that it is no longer in the replica set for a 4773 resource R (i.e., there are three predecessors between N and R), it 4774 SHOULD delete all data associated with R from its local store. 4776 When a peer discovers that its range of responsible IDs have changed, 4777 it MUST send an UPDATE to all entries in its connection table. 4779 9.6.4. Stabilization 4781 There are four components to stabilization: 4782 1. exchange Updates with all peers in its neighbor table to exchange 4783 state. 4784 2. search for better peers to place in its finger table. 4785 3. search to determine if the current finger table size is 4786 sufficiently large. 4787 4. search to determine if the overlay has partitioned and needs to 4788 recover. 4790 9.6.4.1. Updating neighbor table 4792 A peer MUST periodically send an Update request to every peer in its 4793 Connection Table. The purpose of this is to keep the predecessor and 4794 successor lists up to date and to detect failed peers. The default 4795 time is about every ten minutes, but the enrollment server SHOULD set 4796 this in the configuration document using the "chord-reload-update- 4797 interval" element (denominated in seconds.) A peer SHOULD randomly 4798 offset these Update requests so they do not occur all at once. 4800 9.6.4.2. Refreshing finger table 4802 A peer MUST periodically search for new peers to replace invalid 4803 (repeated) entries in the finger table. A finger table entry i is 4804 valid if it is in the range [n+2^(128-i), 4805 n+2^(128-(i-1))-2^(128-(i+1))]. Invalid entries occur in the finger 4806 table when a previous finger table entry has failed or when no peer 4807 has been found in that range. 4809 A peer SHOULD NOT send Ping requests looking for new finger table 4810 entries more often than the configuration element "chord-reload-ping- 4811 interval", which defaults to 3600 seconds (one per hour). 4813 Two possible methods for searching for new peers for the finger table 4814 entries are presented: 4816 Alternative 1: A peer selects one entry in the finger table from 4817 among the invalid entries. It pings for a new peer for that finger 4818 table entry. The selection SHOULD be exponentially weighted to 4819 attempt to replace earlier (lower i) entries in the finger table. A 4820 simple way to implement this selection is to search through the 4821 finger table entries from i=0 and each time an invalid entry is 4822 encountered, send a Ping to replace that entry with probability 0.5. 4824 Alternative 2: A peer monitors the Update messages received from its 4825 connections to observe when an Update indicates a peer that would be 4826 used to replace in invalid finger table entry, i, and flags that 4827 entry in the finger table. Every "chord-reload-ping-interval" 4828 seconds, the peer selects from among those flagged candidates using 4829 an exponentially weighted probability as above. 4831 When searching for a better entry, the peer SHOULD send the Ping to a 4832 Node-ID selected randomly from that range. Random selection is 4833 preferred over a search for strictly spaced entries to minimize the 4834 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 4835 implementation or subsequent specification MAY choose a method for 4836 selecting finger table entries other than choosing randomly within 4837 the range. Any such alternate methods SHOULD be employed only on 4838 finger table stabilization and not for the selection of initial 4839 finger table entries unless the alternative method is faster and 4840 imposes less overhead on the overlay. 4842 A peer MAY choose to keep connections to multiple peers that can act 4843 for a given finger table entry. 4845 9.6.4.3. Adjusting finger table size 4847 If the finger table has less than 16 entries, the node SHOULD attempt 4848 to discover more fingers to grow the size of the table to 16. The 4849 value 16 was chosen to ensure high odds of a node maintaining 4850 connectivity to the overlay even with strange network partitions. 4852 For many overlays, 16 finger table entries will be enough, but as an 4853 overlay grows very large, more than 16 entries may be required in the 4854 finger table for efficient routing. An implementation SHOULD be 4855 capable of increasing the number of entries in the finger table to 4856 128 entries. 4858 Note to implementers: Although log(N) entries are all that are 4859 required for optimal performance, careful implementation of 4860 stabilization will result in no additional traffic being generated 4861 when maintaining a finger table larger than log(N) entries. 4862 Implementers are encouraged to make use of RouteQuery and algorithms 4863 for determining where new finger table entries may be found. 4864 Complete details of possible implementations are outside the scope of 4865 this specification. 4867 A simple approach to sizing the finger table is to ensure the finger 4868 table is large enough to contain at least the final successor in the 4869 peer's neighbor table. 4871 9.6.4.4. Detecting partitioning 4873 To detect that a partitioning has occurred and to heal the overlay, a 4874 peer P MUST periodically repeat the discovery process used in the 4875 initial join for the overlay to locate an appropriate bootstrap node, 4876 B. P should then send a Ping for its own Node-ID routed through B. If 4877 a response is received from a peer S', which is not P's successor, 4878 then the overlay is partitioned and P should send an Attach to S' 4879 routed through B, followed by an Update sent to S'. (Note that S' 4880 may not be in P's neighbor table once the overlay is healed, but the 4881 connection will allow S' to discover appropriate neighbor entries for 4882 itself via its own stabilization.) 4884 Future specifications may describe alternative mechanisms for 4885 determining when to repeat the discovery process. 4887 9.7. Route Query 4889 For this topology plugin, the RouteQueryReq contains no additional 4890 information. The RouteQueryAns contains the single node ID of the 4891 next peer to which the responding peer would have routed the request 4892 message in recursive routing: 4894 struct { 4895 NodeId next_peer; 4896 } ChordRouteQueryAns; 4898 The contents of this structure are as follows: 4900 next_peer 4901 The peer to which the responding peer would route the message in 4902 order to deliver it to the destination listed in the request. 4904 If the requester has set the send_update flag, the responder SHOULD 4905 initiate an Update immediately after sending the RouteQueryAns. 4907 9.8. Leaving 4909 To support extensions, such as [I-D.maenpaa-p2psip-self-tuning], 4910 Peers SHOULD send a Leave request to all members of their neighbor 4911 table prior to exiting the Overlay Instance. The 4912 overlay_specific_data field MUST contain the ChordLeaveData structure 4913 defined below: 4915 enum { reserved (0), 4916 from_succ(1), from_pred(2), (255) } 4917 ChordLeaveType; 4919 struct { 4920 ChordLeaveType type; 4922 select(type) { 4923 case from_succ: 4924 NodeId successors<0..2^16-1>; 4925 case from_pred: 4926 NodeId predecessors<0..2^16-1>; 4927 }; 4928 } ChordLeaveData; 4930 The 'type' field indicates whether the Leave request was sent by a 4931 predecessor or a successor of the recipient: 4933 from_succ 4934 The Leave request was sent by a successor. 4936 from_pred 4937 The Leave request was sent by a predecessor. 4939 If the type of the request is 'from_succ', the contents will be: 4941 successors 4942 The sender's successor list. 4944 If the type of the request is 'from_pred', the contents will be: 4946 predecessors 4947 The sender's predecessor list. 4949 Any peer which receives a Leave for a peer n in its neighbor set 4950 follows procedures as if it had detected a peer failure as described 4951 in Section 9.6.1. 4953 10. Enrollment and Bootstrap 4955 10.1. Overlay Configuration 4957 This specification defines a new content type "application/ 4958 p2p-overlay+xml" for an MIME entity that contains overlay 4959 information. An example document is shown below. 4961 4963 4966 4968 false 4969 4970 4971 30 4972 false 4973 10 4974 4000 4975 https://example.org 4976 foo 4977 300 4978 400 4979 false 4981 asecret 4982 chord 4983 DATA GOES HERE 4984 4985 4986 4987 single 4988 user-match 4989 1 4990 100 4991 4992 4993 VGhpcyBpcyBub3QgcmlnaHQhCg== 4994 4995 4996 4997 4998 array 4999 node-multiple 5000 3 5001 22 5002 4 5003 1 5004 5005 5006 5007 VGhpcyBpcyBub3QgcmlnaHQhCg== 5008 5009 5010 5011 47112162e84c69ba 5012 6eba45d31a900c06 5013 6ebc45d31a900c06 5014 5015 VGhpcyBpcyBub3QgcmlnaHQhCg== 5016 5018 The file MUST be a well formed XML document and it SHOULD contain an 5019 encoding declaration in the XML declaration. If the charset 5020 parameter of the MIME content type declaration is present and it is 5021 different from the encoding declaration, the charset parameter takes 5022 precedence. Every application conforming to this specification MUST 5023 accept the UTF-8 character encoding to ensure minimal 5024 interoperability. The namespace for the elements defined in this 5025 specification is urn:ietf:params:xml:ns:p2p:config-base and 5026 urn:ietf:params:xml:ns:p2p:config-chord". 5028 The file can contain multiple "configuration" elements where each one 5029 contains the configuration information for a different overlay. Each 5030 "configuration" has the following attributes: 5032 instance-name: name of the overlay 5033 expiration: time in future at which this overlay configuration is no 5034 longer valid and needs to be retrieved again 5035 sequence: a monotonically increasing sequence number between 1 and 5036 2^32 5038 Inside each overlay element, the following elements can occur: 5040 topology-plugin This element has an attribute called algorithm-name 5041 that describes the overlay algorithm being used. 5042 root-cert This element contains a PEM encoded X.509v3 certificate 5043 that is a root trust anchor used to sign all certificates in this 5044 overlay. There can be more than one root-cert element. 5045 enrollment-server This element contains the URL at which the 5046 enrollment server can be reached in a "url" element. This URL 5047 MUST be of type "https:". More than one enrollment-server element 5048 may be present. 5049 self-signed-permitted This element indicates whether self-signed 5050 certificates are permitted. If it is set to "true", then self- 5051 signed certificates are allowed, in which case the enrollment- 5052 server and root-cert elements may be absent. Otherwise, it SHOULD 5053 be absent, but MAY be set to "false". This element also contains 5054 an attribute "digest" which indicates the digest to be used to 5055 compute the Node-ID. Valid values for this parameter are "SHA-1" 5056 and "SHA-256". Implementations MUST support both of these 5057 algorithms. 5058 bootstrap-node This element represents the address of one of the 5059 bootstrap nodes. It has an attribute called "address" that 5060 represents the IP address (either IPv4 or IPv6, since they can be 5061 distinguished) and an attribute called "port" that represents the 5062 port. The IP address is in typical decimal of hex from suing 5063 standard period and colon separators. (TODO - provide a reference 5064 to well specified version of this). More than one bootstrap-peer 5065 element may be present. 5066 turn-density This element is a positive integer that represents the 5067 approximate reciprocal of density of nodes that can act as TURN 5068 servers. For example, if 10% of the nodes can act as TURN 5069 servers, this would be set to 10. If it is not present, the 5070 default value is 1. 5072 multicast-bootstrap This element represents the address of a 5073 multicast, broadcast, or anycast address and port that may be used 5074 for bootstrap. Nodes SHOULD listen on the address. It has an 5075 attributed called "address" that represents the IP address and an 5076 attribute called "port" that represents the port. More than one 5077 "multicast-bootstrap" element may be present. 5078 clients-permitted This element represents whether clients are 5079 permitted or whether all nodes must be peers. If it is set to 5080 "TRUE" or absent, this indicates that clients are permitted. If 5081 it is set to "FALSE" then nodes MUST join as peers. 5082 ice-lite-permitted This element represents whether nodes are 5083 allowed to use the "no-ICE" Overlay Link protocols. in this 5084 overlay. If it is absent, it is treated as if it were set to 5085 "FALSE". 5086 chord-update-interval The update frequency for the Chord-reload 5087 topology plugin (see Section 9). 5088 chord-ping-interval The ping frequency for the Chord-reload 5089 topology plugin (see Section 9). 5090 chord-reload-reactive Whether reactive recovery should be used for 5091 this overlay. (see Section 9). 5092 shared-secret If shared secret mode is used, this contains the 5093 shared secret. 5094 max-message-size Maximum size in bytes of any message in the 5095 overlay. If this value is not present, the default is 5000. 5096 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5097 for messages. If this value is not present, the default is 100. 5098 kind-signer This contains a single Node-ID in hexadecimal and 5099 indicates that the certificate with this Node-ID is allowed to 5100 sign kinds. Identifying kind-signer by Node-ID instead of 5101 certificate allows the use of short lived certificates without 5102 constantly having to provide an updated configuration file. 5103 bad-node This contains a single Node-ID in hexadecimal and 5104 indicates that the certificate with this Node-ID MUST not be 5105 considered valid. This allows certificate revocation. 5107 Inside each overlay element, the required-kinds elements can also 5108 occur. This element indicates the kinds that members must support 5109 and contains multiple kind-block elements that each define a single 5110 kind that MUST be supported by nodes in the overlay. Each kind-block 5111 consists of a single kind element and a kind-signature. The kind 5112 element defines the kind. The kind-signature is the signature 5113 computed over the kind element. 5115 Each kind has either an ID attribute or a name atribute. The name 5116 attribute is a string representing the kind (the name registered to 5117 IANA) while the ID is an integer kind-id allocated out of private 5118 space. 5120 In addition, the kind element contains the following elements: 5121 max-count: the maximum number of values which members of the overlay 5122 must support. 5123 data-model: the data model to be used. 5124 max-size: the maximum size of individual values. 5125 access-control: the access control model to be used. 5126 max-node-multiple: This is optional and only used when the access 5127 control is NODE-MULTIPLE. This indicates the maximum value for 5128 the i counter. This is an integer greater than 0. 5130 All of the non optional values MUST be provided. If the kind is 5131 registered with IANA, the data-model and access-control attributes 5132 MUST match those in the kind registration. For instance, the example 5133 above indicates that members must support SIP-REGISTRATION with a 5134 maximum of 10 values of up to 1000 bytes each. Multiple required- 5135 kinds elements MAY be present. 5137 The kind-block element also MUST contain a "kind-signature" element. 5138 This signature is computed across the kind from the beginning of the 5139 first < of the kind to the end of the last > of the kind in the same 5140 way as the "signature element described later in this section. 5142 The configuration file is a binary file and cannot be changed - 5143 including whitespace changes - or the signature will break. The 5144 signature is computed by taking each configuration element and 5145 starting form, and including, the first < at the start of 5146 up to and including the > in and 5147 treating this as a binary blob that is signed using the standard 5148 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5149 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5150 signature element following the configuration object in the config 5151 file. 5153 When a node receives a new configuration file, it MUST change its 5154 configuration to meet the new requirements. This may require the 5155 node to exit the DHT and re-join. If a node is not capable of 5156 supporting the new requirements, it MUST exit the overlay. If some 5157 information about a particular kind changes from what the node 5158 previously knew about the kind (for example the max size), the new 5159 information in the configuration files overrides any previously 5160 learned information. If any kind data was signed by a node that is 5161 no longer allowed to sign kinds, that kind MUST be discarded along 5162 with any stored information of that kind. Note that forcing an 5163 avalanche restart of the overlay with a configuration change that 5164 requires re-joining the overlay may result in serious performance 5165 problems, including total collapse of the network if configuration 5166 parameters are not properly considered. Such an event may be 5167 necessary in case of a compromised CA or similar problem, but for 5168 large overlays should be avoided in almost all circumstances. 5170 10.1.1. Relax NG Grammar 5172 The grammar for the configuration data is: 5174 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5175 namespace local = "" 5176 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5177 namespace rng = "http://relaxng.org/ns/structure/1.0" 5179 anything = 5180 (element * { anything } 5181 | attribute * { text } 5182 | text)* 5184 foreign-elements = element * - (p2pcf:* | local:* | chord:*) { anything }* 5185 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) { text }* 5186 foreign-nodes = (foreign-attributes | foreign-elements)* 5188 start = 5189 element p2pcf:overlay { 5190 element configuration { 5191 attribute instance-name { text }, 5192 attribute expiration { xsd:dateTime }, 5193 attribute sequence { xsd:long }, 5194 parameter 5195 }, 5196 element signature { 5197 attribute algorithm { signature-algorithm-type }?, 5198 xsd:base64Binary 5199 }? 5200 } 5201 signature-algorithm-type |= "rsa-sha1" 5203 parameter &= element topology-plugin { topology-plugin-type } 5204 parameter &= element max-message-size { xsd:int }? 5205 parameter &= element initial-ttl { xsd:int }? 5206 parameter &= element root-cert { text }? 5207 parameter &= element required-kinds { kind-block* } 5208 parameter &= element enrollment-server { xsd:anyURI }? 5209 parameter &= element kind-signer { text }* 5210 parameter &= element bad-node { text }* 5211 parameter &= element attach-lite-permitted { xsd:boolean }? 5212 parameter &= element shared-secret { xsd:string }? 5213 parameter &= element clients-permitted { xsd:boolean }? 5214 parameter &= element turn-density { xsd:int }? 5215 parameter &= foreign-elements* 5216 parameter &= 5217 element self-signed-permitted { 5218 attribute digest { self-signed-digest-type }, 5219 xsd:boolean 5220 }? 5221 self-signed-digest-type |= "sha1" 5222 parameter &= 5223 element bootstrap-node { 5224 attribute address { xsd:string }, 5225 attribute port { xsd:int } 5226 }+ 5227 hostPort = text 5228 parameter &= 5229 element multicast-bootstrap { hostPort 5230 }* 5232 kind-block = element kind-block { 5233 element kind { 5234 (attribute name { kind-names } 5235 | attribute id { xsd:int }), 5236 kind-paramter 5237 } & 5238 element kind-signature { 5239 attribute algorithm { signature-algorithm-type }?, 5240 xsd:base64Binary 5241 }? 5243 } 5245 kind-paramter &= element max-count { xsd:int } 5246 kind-paramter &= element max-size { xsd:int } 5247 kind-paramter &= element data-model { data-model-type } 5248 data-model-type |= "single" 5249 data-model-type |= "array" 5250 data-model-type |= "dictionary" 5251 kind-paramter &= element access-control { access-control-type } 5252 kind-paramter &= element max-node-multiple { xsd:int }? 5253 access-control-type |= "user-match" 5254 access-control-type |= "node-match" 5255 access-control-type |= "user-node-match" 5256 access-control-type |= "node-multiple" 5257 access-control-type |= "user-match-with-anon-create" 5258 kind-paramter &= foreign-elements* 5260 # Chord specific paramters 5261 topology-plugin-type |= "chord" 5262 kind-names |= "sip-registration" 5263 kind-names |= "turn-service" 5264 parameter &= element chord:chord-ping-interval { xsd:int }? 5265 parameter &= element chord:chord-update-interval { xsd:int }? 5267 10.2. Discovery Through Enrollment Server 5269 When a node first enrolls in a new overlay, it starts with a 5270 discovery process to find an enrollment server. Related work to the 5271 approach used here is described in 5272 [I-D.garcia-p2psip-dns-sd-bootstrapping] and 5273 [I-D.matthews-p2psip-bootstrap-mechanisms]. Another scheme for 5274 referencing overlays is described in 5275 [I-D.hardie-p2poverlay-pointers]. 5277 The node first determines the overlay name. This value is provided 5278 by the user or some other out-of-band provisioning mechanism. The 5279 out-of-band mechanisms may also provide an optional URL for the 5280 enrollment server. If a URL for the enrollment server is not 5281 provided, the node MUST do a DNS SRV query using a Service name of 5282 "p2psip_enroll" and a protocol of tcp to find an enrollment server 5283 and form the URL by appending a path of "/p2psip/enroll" to the 5284 overlay name. For example, if the overlay name was example.com, the 5285 URL would be "https://example.com/p2psip/enroll". 5287 Once an address and URL for the enrollment server is determined, the 5288 peer forms an HTTPS connection to that IP address. The certificate 5289 MUST match the overlay name as described in [RFC2818]. Then the node 5290 MUST fetch a new copy of the configuration file. To do this, the 5291 peer performs a GET to the URL. The result of the HTTP GET is an XML 5292 configuration file described above, which replaces any previously 5293 learned configuration file for this overlay. 5295 For overlays that do not use an enrollment server, nodes obtain the 5296 configuration information needed to join the overlay through some out 5297 of band approach such an an XML configuration file sent over email. 5299 10.3. Credentials 5301 If the configuration document contains a enrollment-server element, 5302 credentials are required to join the Overlay Instance. A peer which 5303 does not yet have credentials MUST contact the enrollment server to 5304 acquire them. 5306 RELOAD defines its own trivial certificate request protocol. We 5307 would have liked to have used an existing protocol but were concerned 5308 about the implementation burden of even the simplest of those 5309 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5310 have a protocol which could be easily implemented in a Web server 5311 which the operator did not control (e.g., in a hosted service) and 5312 was compatible with the existing certificate handling tooling as used 5313 with the Web certificate infrastructure. This means accepting bare 5314 PKCS#10 requests and returning a single bare X.509 certificate. 5315 Although the MIME types for these objects are defined, none of the 5316 existing protocols support exactly this model. 5318 The certificate request protocol is performed over HTTPS. The 5319 request is an HTTP POST with the following properties: 5321 o If authentication is required, there is a URL parameter of 5322 "password" and "username" containing the user's name and password 5323 in the clear (hence the need for HTTPS) 5324 o The body is of content type "application/pkcs10", as defined in 5325 [RFC2311]. 5326 o The Accept header contains the type "application/pkix-cert", 5327 indicating the type that is expected in the response. 5329 The enrollment server MUST authenticate the request using the 5330 provided user name and password. If the authentication succeeds and 5331 the requested user name is acceptable, the server generates and 5332 returns a certificate. The SubjectAltName field in the certificate 5333 contains the following values: 5335 o One or more Node-IDs which MUST be cryptographically random 5336 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5337 way that they are unpredictable to the requesting user. Each is 5338 placed in the subjectAltName using the uniformResourceIdentifier 5339 type and MUST contain RELOAD URIs as described in Section 13.13 5340 and MUST contain a Destination list with a single entry of type 5341 "node_id". 5342 o A single name this user is allowed to use in the overlay, using 5343 type rfc822Name. 5345 The certificate is returned as type "application/pkix-cert", with an 5346 HTTP status code of 200 OK. Certificate processing errors should be 5347 treated as HTTP errors and have appropriate HTTP status codes. 5349 The client MUST check that the certificate returned was signed by one 5350 of the certificates received in the "root-cert" list of the overlay 5351 configuration data. The node then reads the certificate to find the 5352 Node-IDs it can use. 5354 10.3.1. Self-Generated Credentials 5356 If the "self-signed-permitted" element is present and set to "TRUE", 5357 then a node MUST generate its own self-signed certificate to join the 5358 overlay. The self-signed certificate MAY contain any user name of 5359 the users choice. 5361 The Node-ID MUST be computed by applying the digest specified in the 5362 self-signed-permitted element to the DER representation of the user's 5363 public key (more specifically the subjectPublicKeyInfo) and taking 5364 the high order bits. When accepting a self-signed certificate, nodes 5365 MUST check that the Node-ID and public keys match. This prevents 5366 Node-ID theft. 5368 Once the node has constructed a self-signed certificate, it MAY join 5369 the overlay. Before storing its certificate in the overlay 5370 (Section 7) it SHOULD look to see if the user name is already taken 5371 and if so choose another user name. Note that this only provides 5372 protection against accidental name collisions. Name theft is still 5373 possible. If protection against name theft is desired, then the 5374 enrollment service must be used. 5376 10.4. Searching for a Bootstrap Node 5378 If no cached bootstrap nodes are available and the config file has an 5379 multicast-bootstrap element, then the node SHOULD send a Ping request 5380 over UDP to the address and port found to each multicast-bootstrap 5381 element found in the configuration document. This MAY be a 5382 multicast, broadcast, or anycast address. The Ping should use the 5383 wildcard Node-ID as the destination Node-ID. 5385 The responder node that receives the Ping request SHOULD check that 5386 the overlay name is correct and that the requester peer sending the 5387 request has appropriate credentials for the overlay before responding 5388 to the Ping request even if the response is only an error. 5390 10.5. Contacting a Bootstrap Node 5392 In order to join the overlay, the joining node MUST contact a node in 5393 the overlay. Typically this means contacting the bootstrap nodes, 5394 since they are reachable by the local peer or have public IP 5395 addresses. If the joining node has cached a list of peers it has 5396 previously been connected with in this overlay, as an optimization it 5397 MAY attempt to use one or more of them as bootstrap nodes before 5398 falling back to the bootstrap nodes listed in the configuration file. 5400 When contacting a bootstrap node, the joining node first forms the 5401 DTLS or TLS connection to the boostrap node and then sends an Attach 5402 request over this connection with the destination Node-ID set to the 5403 joining node's Node-ID. 5405 When the requester node finally does receive a response from some 5406 responding node, it can note the Node-ID in the response and use this 5407 Node-ID to start sending requests to join the Overlay Instance as 5408 described in Section 5.4. 5410 After a node has successfully joined the overlay network, it will 5411 have direct connections to several peers. Some MAY be added to the 5412 cached bootstrap nodes list and used in future boots. Peers that are 5413 not directly connected MUST NOT be cached. The suggested number of 5414 peers to cache is 10. Algorithms for determining which peers to 5415 cache are beyond the scope of this specification. 5417 11. Message Flow Example 5419 In the following example, we assume that JP has formed a connection 5420 to one of the bootstrap nodes. JP then sends an Attach through that 5421 peer to the admitting peer (AP) to initiate a connection. When AP 5422 responds, JP and AP use ICE to set up a connection and then set up 5423 TLS. 5425 JP PPP PP AP NP NNP BP 5426 | | | | | | | 5427 | | | | | | | 5428 | | | | | | | 5429 |Attach Dest=JP | | | | | 5430 |---------------------------------------------------------->| 5431 | | | | | | | 5432 | | | | | | | 5433 | | |Attach Dest=JP | | | 5434 | | |<--------------------------------------| 5435 | | | | | | | 5436 | | | | | | | 5437 | | |Attach Dest=JP | | | 5438 | | |-------->| | | | 5439 | | | | | | | 5440 | | | | | | | 5441 | | |AttachAns | | | 5442 | | |<--------| | | | 5443 | | | | | | | 5444 | | | | | | | 5445 | | |AttachAns | | | 5446 | | |-------------------------------------->| 5447 | | | | | | | 5448 | | | | | | | 5449 |AttachAns | | | | | 5450 |<----------------------------------------------------------| 5451 | | | | | | | 5452 | | | | | | | 5453 |TLS | | | | | | 5454 |.............................| | | | 5455 | | | | | | | 5456 | | | | | | | 5457 | | | | | | | 5458 | | | | | | | 5460 Once JP has connected to AP, it needs to populate its Routing Table. 5461 In Chord, this means that it needs to populate its neighbor table and 5462 its finger table. To populate its neighbor table, it needs the 5463 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 5464 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 5465 to set up a connection. 5467 JP PPP PP AP NP NNP BP 5468 | | | | | | | 5469 | | | | | | | 5470 | | | | | | | 5471 |Attach AP+1 | | | | | 5472 |---------------------------->| | | | 5473 | | | | | | | 5474 | | | | | | | 5475 | | | |Attach AP+1 | | 5476 | | | |-------->| | | 5477 | | | | | | | 5478 | | | | | | | 5479 | | | |AttachAns | | 5480 | | | |<--------| | | 5481 | | | | | | | 5482 | | | | | | | 5483 |AttachAns | | | | | 5484 |<----------------------------| | | | 5485 | | | | | | | 5486 | | | | | | | 5487 |Attach | | | | | | 5488 |-------------------------------------->| | | 5489 | | | | | | | 5490 | | | | | | | 5491 |TLS | | | | | | 5492 |.......................................| | | 5493 | | | | | | | 5494 | | | | | | | 5495 | | | | | | | 5496 | | | | | | | 5498 JP also needs to populate its finger table (for Chord). It issues an 5499 Attach to a variety of locations around the overlay. The diagram 5500 below shows it sending an Attach halfway around the Chord ring to the 5501 JP + 2^127. 5503 JP NP XX TP 5504 | | | | 5505 | | | | 5506 | | | | 5507 |Attach JP+2<<126 | | 5508 |-------->| | | 5509 | | | | 5510 | | | | 5511 | |Attach JP+2<<126 | 5512 | |-------->| | 5513 | | | | 5514 | | | | 5515 | | |Attach JP+2<<126 5516 | | |-------->| 5517 | | | | 5518 | | | | 5519 | | |AttachAns| 5520 | | |<--------| 5521 | | | | 5522 | | | | 5523 | |AttachAns| | 5524 | |<--------| | 5525 | | | | 5526 | | | | 5527 |AttachAns| | | 5528 |<--------| | | 5529 | | | | 5530 | | | | 5531 |TLS | | | 5532 |.............................| 5533 | | | | 5534 | | | | 5535 | | | | 5536 | | | | 5538 Once JP has a reasonable set of connections it is ready to take its 5539 place in the DHT. It does this by sending a Join to AP. AP does a 5540 series of Store requests to JP to store the data that JP will be 5541 responsible for. AP then sends JP an Update explicitly labeling JP 5542 as its predecessor. At this point, JP is part of the ring and 5543 responsible for a section of the overlay. AP can now forget any data 5544 which is assigned to JP and not AP. 5546 JP PPP PP AP NP NNP BP 5547 | | | | | | | 5548 | | | | | | | 5549 | | | | | | | 5550 |JoinReq | | | | | | 5551 |---------------------------->| | | | 5552 | | | | | | | 5553 | | | | | | | 5554 |JoinAns | | | | | | 5555 |<----------------------------| | | | 5556 | | | | | | | 5557 | | | | | | | 5558 |StoreReq Data A | | | | | 5559 |<----------------------------| | | | 5560 | | | | | | | 5561 | | | | | | | 5562 |StoreAns | | | | | | 5563 |---------------------------->| | | | 5564 | | | | | | | 5565 | | | | | | | 5566 |StoreReq Data B | | | | | 5567 |<----------------------------| | | | 5568 | | | | | | | 5569 | | | | | | | 5570 |StoreAns | | | | | | 5571 |---------------------------->| | | | 5572 | | | | | | | 5573 | | | | | | | 5574 |UpdateReq| | | | | | 5575 |<----------------------------| | | | 5576 | | | | | | | 5577 | | | | | | | 5578 |UpdateAns| | | | | | 5579 |---------------------------->| | | | 5580 | | | | | | | 5581 | | | | | | | 5582 | | | | | | | 5583 | | | | | | | 5585 In Chord, JP's neighbor table needs to contain its own predecessors. 5586 It couldn't connect to them previously because it did not yet know 5587 their addresses. However, now that it has received an Update from 5588 AP, it has AP's predecessors, which are also its own, so it sends 5589 Attaches to them. Below it is shown connecting to AP's closest 5590 predecessor, PP. 5592 JP PPP PP AP NP NNP BP 5593 | | | | | | | 5594 | | | | | | | 5595 | | | | | | | 5596 |Attach Dest=PP | | | | | 5597 |---------------------------->| | | | 5598 | | | | | | | 5599 | | | | | | | 5600 | | |Attach Dest=PP | | | 5601 | | |<--------| | | | 5602 | | | | | | | 5603 | | | | | | | 5604 | | |AttachAns| | | | 5605 | | |-------->| | | | 5606 | | | | | | | 5607 | | | | | | | 5608 |AttachAns| | | | | | 5609 |<----------------------------| | | | 5610 | | | | | | | 5611 | | | | | | | 5612 |TLS | | | | | | 5613 |...................| | | | | 5614 | | | | | | | 5615 | | | | | | | 5616 |UpdateReq| | | | | | 5617 |------------------>| | | | | 5618 | | | | | | | 5619 | | | | | | | 5620 |UpdateAns| | | | | | 5621 |<------------------| | | | | 5622 | | | | | | | 5623 | | | | | | | 5624 |UpdateReq| | | | | | 5625 |---------------------------->| | | | 5626 | | | | | | | 5627 | | | | | | | 5628 |UpdateAns| | | | | | 5629 |<----------------------------| | | | 5630 | | | | | | | 5631 | | | | | | | 5632 |UpdateReq| | | | | | 5633 |-------------------------------------->| | | 5634 | | | | | | | 5635 | | | | | | | 5636 |UpdateAns| | | | | | 5637 |<--------------------------------------| | | 5638 | | | | | | | 5639 | | | | | | | 5641 Finally, now that JP has a copy of all the data and is ready to route 5642 messages and receive requests, it sends Updates to everyone in its 5643 Routing Table to tell them it is ready to go. Below, it is shown 5644 sending such an update to TP. 5646 JP NP XX TP 5647 | | | | 5648 | | | | 5649 | | | | 5650 |Update | | | 5651 |---------------------------->| 5652 | | | | 5653 | | | | 5654 |UpdateAns| | | 5655 |<----------------------------| 5656 | | | | 5657 | | | | 5658 | | | | 5659 | | | | 5661 12. Security Considerations 5663 12.1. Overview 5665 RELOAD provides a generic storage service, albeit one designed to be 5666 useful for P2PSIP. In this section we discuss security issues that 5667 are likely to be relevant to any usage of RELOAD. More background 5668 information can be found in [I-D.irtf-p2prg-rtc-security]. 5670 In any Overlay Instance, any given user depends on a number of peers 5671 with which they have no well-defined relationship except that they 5672 are fellow members of the Overlay Instance. In practice, these other 5673 nodes may be friendly, lazy, curious, or outright malicious. No 5674 security system can provide complete protection in an environment 5675 where most nodes are malicious. The goal of security in RELOAD is to 5676 provide strong security guarantees of some properties even in the 5677 face of a large number of malicious nodes and to allow the overlay to 5678 function correctly in the face of a modest number of malicious nodes. 5680 P2PSIP deployments require the ability to authenticate both peers and 5681 resources (users) without the active presence of a trusted entity in 5682 the system. We describe two mechanisms. The first mechanism is 5683 based on public key certificates and is suitable for general 5684 deployments. The second is an admission control mechanism based on 5685 an overlay-wide shared symmetric key. 5687 12.2. Attacks on P2P Overlays 5689 The two basic functions provided by overlay nodes are storage and 5690 routing: some node is responsible for storing a peer's data and for 5691 allowing a third peer to fetch this stored data. Other nodes are 5692 responsible for routing messages to and from the storing nodes. Each 5693 of these issues is covered in the following sections. 5695 P2P overlays are subject to attacks by subversive nodes that may 5696 attempt to disrupt routing, corrupt or remove user registrations, or 5697 eavesdrop on signaling. The certificate-based security algorithms we 5698 describe in this specification are intended to protect overlay 5699 routing and user registration information in RELOAD messages. 5701 To protect the signaling from attackers pretending to be valid peers 5702 (or peers other than themselves), the first requirement is to ensure 5703 that all messages are received from authorized members of the 5704 overlay. For this reason, RELOAD transports all messages over a 5705 secure channel (TLS and DTLS are defined in this document) which 5706 provides message integrity and authentication of the directly 5707 communicating peer. In addition, messages and data are digitally 5708 signed with the sender's private key, providing end-to-end security 5709 for communications. 5711 12.3. Certificate-based Security 5713 This specification stores users' registrations and possibly other 5714 data in an overlay network. This requires a solution to securing 5715 this data as well as securing, as well as possible, the routing in 5716 the overlay. Both types of security are based on requiring that 5717 every entity in the system (whether user or peer) authenticate 5718 cryptographically using an asymmetric key pair tied to a certificate. 5720 When a user enrolls in the Overlay Instance, they request or are 5721 assigned a unique name, such as "alice@dht.example.net". These names 5722 are unique and are meant to be chosen and used by humans much like a 5723 SIP Address of Record (AOR) or an email address. The user is also 5724 assigned one or more Node-IDs by the central enrollment authority. 5725 Both the name and the Peer-ID are placed in the certificate, along 5726 with the user's public key. 5728 Each certificate enables an entity to act in two sorts of roles: 5730 o As a user, storing data at specific Resource-IDs in the Overlay 5731 Instance corresponding to the user name. 5732 o As a overlay peer with the Peer-ID(s) listed in the certificate. 5734 Note that since only users of this Overlay Instance need to validate 5735 a certificate, this usage does not require a global PKI. Instead, 5736 certificates are signed by a central enrollment authority which acts 5737 as the certificate authority for the Overlay Instance. This 5738 authority signs each peer's certificate. Because each peer possesses 5739 the CA's certificate (which they receive on enrollment) they can 5740 verify the certificates of the other entities in the overlay without 5741 further communication. Because the certificates contain the user/ 5742 peer's public key, communications from the user/peer can be verified 5743 in turn. 5745 If self-signed certificates are used, then the security provided is 5746 significantly decreased, since attackers can mount Sybil attacks. In 5747 addition, attackers cannot trust the user names in certificates 5748 (though they can trust the Node-IDs because they are 5749 cryptographically verifiable). This scheme may be appropriate for 5750 some small deployments, such as a small office or an ad hoc overlay 5751 set up among participants in a meeting where all hosts on the network 5752 are trusted. Some additional security can be provided by using the 5753 shared secret admission control scheme as well. 5755 Because all stored data is signed by the owner of the data the 5756 storing peer can verify that the storer is authorized to perform a 5757 store at that Resource-ID and also allow any consumer of the data to 5758 verify the provenance and integrity of the data when it retrieves it. 5760 Note that RELOAD does not itself provide a revocation/status 5761 mechanism (though certificates may of course include OCSP responder 5762 information). Thus, certificate lifetimes should be chosen to 5763 balance the compromise window versus the cost of certificate renewal. 5764 Because RELOAD is already designed to operate in the face of some 5765 fraction of malicious peers, this form of compromise is not fatal. 5767 All implementations MUST implement certificate-based security. 5769 12.4. Shared-Secret Security 5771 RELOAD also supports a shared secret admission control scheme that 5772 relies on a single key that is shared among all members of the 5773 overlay. It is appropriate for small groups that wish to form a 5774 private network without complexity. In shared secret mode, all the 5775 peers share a single symmetric key which is used to key TLS-PSK 5776 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 5777 key cannot form TLS connections with any other peer and therefore 5778 cannot join the overlay. 5780 One natural approach to a shared-secret scheme is to use a user- 5781 entered password as the key. The difficulty with this is that in 5782 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 5784 If passwords are used as the source of shared-keys, then TLS-SRP is a 5785 superior choice because it is not subject to dictionary attacks. 5787 12.5. Storage Security 5789 When certificate-based security is used in RELOAD, any given 5790 Resource-ID/Kind-ID pair is bound to some small set of certificates. 5791 In order to write data, the writer must prove possession of the 5792 private key for one of those certificates. Moreover, all data is 5793 stored, signed with the same private key that was used to authorize 5794 the storage. This set of rules makes questions of authorization and 5795 data integrity - which have historically been thorny for overlays - 5796 relatively simple. 5798 12.5.1. Authorization 5800 When a client wants to store some value, it first digitally signs the 5801 value with its own private key. It then sends a Store request that 5802 contains both the value and the signature towards the storing peer 5803 (which is defined by the Resource Name construction algorithm for 5804 that particular kind of value). 5806 When the storing peer receives the request, it must determine whether 5807 the storing client is authorized to store at this Resource-ID/Kind-ID 5808 pair. Determining this requires comparing the user's identity to the 5809 requirements of the access control model (see Section 6.3). If it 5810 satisfies those requirements the user is authorized to write, pending 5811 quota checks as described in the next section. 5813 For example, consider the certificate with the following properties: 5815 User name: alice@dht.example.com 5816 Node-ID: 013456789abcdef 5817 Serial: 1234 5819 If Alice wishes to Store a value of the "SIP Location" kind, the 5820 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 5821 Resource-ID will be determined by hashing the Resource Name. Because 5822 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 5823 the user name in the certificate hashes to the requested Resource-ID. 5824 It then verifies that the node-id in the certificate matches the 5825 dictionary key being used for the store. If both of these checks 5826 succeed, the Store is authorized. Note that because the access 5827 control model is different for different kinds, the exact set of 5828 checks will vary. 5830 12.5.2. Distributed Quota 5832 Being a peer in an Overlay Instance carries with it the 5833 responsibility to store data for a given region of the Overlay 5834 Instance. However, allowing clients to store unlimited amounts of 5835 data would create unacceptable burdens on peers and would also enable 5836 trivial denial of service attacks. RELOAD addresses this issue by 5837 requiring configurations to define maximum sizes for each kind of 5838 stored data. Attempts to store values exceeding this size MUST be 5839 rejected (if peers are inconsistent about this, then strange 5840 artifacts will happen when the zone of responsibility shifts and a 5841 different peer becomes responsible for overlarge data). Because each 5842 Resource-ID/Kind-ID pair is bound to a small set of certificates, 5843 these size restrictions also create a distributed quota mechanism, 5844 with the quotas administered by the central enrollment server. 5846 Allowing different kinds of data to have different size restrictions 5847 allows new usages the flexibility to define limits that fit their 5848 needs without requiring all usages to have expansive limits. 5850 12.5.3. Correctness 5852 Because each stored value is signed, it is trivial for any retrieving 5853 peer to verify the integrity of the stored value. Some more care 5854 needs to be taken to prevent version rollback attacks. Rollback 5855 attacks on storage are prevented by the use of store times and 5856 lifetime values in each store. A lifetime represents the latest time 5857 at which the data is valid and thus limits (though does not 5858 completely prevent) the ability of the storing node to perform a 5859 rollback attack on retrievers. In order to prevent a rollback attack 5860 at the time of the Store request, we require that storage times be 5861 monotonically increasing. Storing peers MUST reject Store requests 5862 with storage times smaller than or equal to those they are currently 5863 storing. In addition, a fetching node which receives a data value 5864 with a storage time older than the result of the previous fetch knows 5865 a rollback has occurred. 5867 12.5.4. Residual Attacks 5869 The mechanisms described here provides a high degree of security, but 5870 some attacks remain possible. Most simply, it is possible for 5871 storing nodes to refuse to store a value (i.e., reject any request). 5872 In addition, a storing node can deny knowledge of values which it has 5873 previously accepted. To some extent these attacks can be ameliorated 5874 by attempting to store to/retrieve from replicas, but a retrieving 5875 client does not know whether it should try this or not, since there 5876 is a cost to doing so. 5878 The certificate-based authentication scheme prevents a single peer 5879 from being able to forge data owned by other peers. Furthermore, 5880 although a subversive peer can refuse to return data resources for 5881 which it is responsible, it cannot return forged data because it 5882 cannot provide authentication for such registrations. Therefore 5883 parallel searches for redundant registrations can mitigate most of 5884 the effects of a compromised peer. The ultimate reliability of such 5885 an overlay is a statistical question based on the replication factor 5886 and the percentage of compromised peers. 5888 In addition, when a kind is multivalued (e.g., an array data model), 5889 the storing node can return only some subset of the values, thus 5890 biasing its responses. This can be countered by using single values 5891 rather than sets, but that makes coordination between multiple 5892 storing agents much more difficult. This is a trade off that must be 5893 made when designing any usage. 5895 12.6. Routing Security 5897 Because the storage security system guarantees (within limits) the 5898 integrity of the stored data, routing security focuses on stopping 5899 the attacker from performing a DOS attack that misroutes requests in 5900 the overlay. There are a few obvious observations to make about 5901 this. First, it is easy to ensure that an attacker is at least a 5902 valid peer in the Overlay Instance. Second, this is a DOS attack 5903 only. Third, if a large percentage of the peers on the Overlay 5904 Instance are controlled by the attacker, it is probably impossible to 5905 perfectly secure against this. 5907 12.6.1. Background 5909 In general, attacks on DHT routing are mounted by the attacker 5910 arranging to route traffic through one or two nodes it controls. In 5911 the Eclipse attack [Eclipse] the attacker tampers with messages to 5912 and from nodes for which it is on-path with respect to a given victim 5913 node. This allows it to pretend to be all the nodes that are 5914 reachable through it. In the Sybil attack [Sybil], the attacker 5915 registers a large number of nodes and is therefore able to capture a 5916 large amount of the traffic through the DHT. 5918 Both the Eclipse and Sybil attacks require the attacker to be able to 5919 exercise control over her Peer-IDs. The Sybil attack requires the 5920 creation of a large number of peers. The Eclipse attack requires 5921 that the attacker be able to impersonate specific peers. In both 5922 cases, these attacks are limited by the use of centralized, 5923 certificate-based admission control. 5925 12.6.2. Admissions Control 5927 Admission to a RELOAD Overlay Instance is controlled by requiring 5928 that each peer have a certificate containing its Peer-ID. The 5929 requirement to have a certificate is enforced by using certificate- 5930 based mutual authentication on each connection. (Note: the 5931 following only applies when self-signed certificates are not used.) 5932 Whenever a peer connects to another peer, each side automatically 5933 checks that the other has a suitable certificate. These Peer-IDs are 5934 randomly assigned by the central enrollment server. This has two 5935 benefits: 5937 o It allows the enrollment server to limit the number of peer IDs 5938 issued to any individual user. 5939 o It prevents the attacker from choosing specific Peer-IDs. 5941 The first property allows protection against Sybil attacks (provided 5942 the enrollment server uses strict rate limiting policies). The 5943 second property deters but does not completely prevent Eclipse 5944 attacks. Because an Eclipse attacker must impersonate peers on the 5945 other side of the attacker, he must have a certificate for suitable 5946 Peer-IDs, which requires him to repeatedly query the enrollment 5947 server for new certificates, which will match only by chance. From 5948 the attacker's perspective, the difficulty is that if he only has a 5949 small number of certificates, the region of the Overlay Instance he 5950 is impersonating appears to be very sparsely populated by comparison 5951 to the victim's local region. 5953 12.6.3. Peer Identification and Authentication 5955 In general, whenever a peer engages in overlay activity that might 5956 affect the routing table it must establish its identity. This 5957 happens in two ways. First, whenever a peer establishes a direct 5958 connection to another peer it authenticates via certificate-based 5959 mutual authentication. All messages between peers are sent over this 5960 protected channel and therefore the peers can verify the data origin 5961 of the last hop peer for requests and responses without further 5962 cryptography. 5964 In some situations, however, it is desirable to be able to establish 5965 the identity of a peer with whom one is not directly connected. The 5966 most natural case is when a peer Updates its state. At this point, 5967 other peers may need to update their view of the overlay structure, 5968 but they need to verify that the Update message came from the actual 5969 peer rather than from an attacker. To prevent this, all overlay 5970 routing messages are signed by the peer that generated them. 5972 Replay is typically prevented for messages that impact the topology 5973 of the overlay by having the information come directly, or be 5974 verified by, the nodes that claimed to have generated the update. 5975 Data storage replay detection is done by signing time of the node 5976 that generated the signature on the store request thus providing a 5977 time based replay protection but the time synchronization is only 5978 needed between peers that can write to the same location. 5980 12.6.4. Protecting the Signaling 5982 The goal here is to stop an attacker from knowing who is signaling 5983 what to whom. An attacker is unlikely to be able to observe the 5984 activities of a specific individual given the randomization of IDs 5985 and routing based on the present peers discussed above. Furthermore, 5986 because messages can be routed using only the header information, the 5987 actual body of the RELOAD message can be encrypted during 5988 transmission. 5990 There are two lines of defense here. The first is the use of TLS or 5991 DTLS for each communications link between peers. This provides 5992 protection against attackers who are not members of the overlay. The 5993 second line of defense is to digitally sign each message. This 5994 prevents adversarial peers from modifying messages in flight, even if 5995 they are on the routing path. 5997 12.6.5. Residual Attacks 5999 The routing security mechanisms in RELOAD are designed to contain 6000 rather than eliminate attacks on routing. It is still possible for 6001 an attacker to mount a variety of attacks. In particular, if an 6002 attacker is able to take up a position on the overlay routing between 6003 A and B it can make it appear as if B does not exist or is 6004 disconnected. It can also advertise false network metrics in an 6005 attempt to reroute traffic. However, these are primarily DOS 6006 attacks. 6008 The certificate-based security scheme secures the namespace, but if 6009 an individual peer is compromised or if an attacker obtains a 6010 certificate from the CA, then a number of subversive peers can still 6011 appear in the overlay. While these peers cannot falsify responses to 6012 resource queries, they can respond with error messages, effecting a 6013 DoS attack on the resource registration. They can also subvert 6014 routing to other compromised peers. To defend against such attacks, 6015 a resource search must still consist of parallel searches for 6016 replicated registrations. 6018 13. IANA Considerations 6020 This section contains the new code points registered by this 6021 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6022 the RFC number for this specification in the following list.] 6024 13.1. Port Registrations 6026 [[Note to RFC Editor - this paragraph can be removed before 6027 publication. ]] IANA has already allocated a port for the main peer 6028 to peer protocol. This port has the name p2p-sip and the port number 6029 of 6084. The names of this port may need to be changed as this draft 6030 progresses and if it does careful instructions will be needed to IANA 6031 to ensure the final RFC and IANA registrations are in sync. 6033 IANA will make the following port registration: 6035 +-------------------------------+-----------------------------------+ 6036 | Registration Technical | Cullen Jennings | 6037 | Contact | | 6038 | Registration Owner | IETF | 6039 | Transport Protocol | TCP, UDP | 6040 | Port Number | 6084 | 6041 | Service Name | p2psip_enroll | 6042 | Description | RELOAD P2P Protcol | 6043 | Reference | [RFC-AAAA] | 6044 +-------------------------------+-----------------------------------+ 6046 13.2. Overlay Algorithm Types 6048 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6049 Entries in this registry are strings denoting the names of overlay 6050 algorithms. The registration policy for this registry is RFC 5226 6051 IETF Review. The initial contents of this registry are: 6053 +----------------+----------+ 6054 | Algorithm Name | RFC | 6055 +----------------+----------+ 6056 | chord-reload | RFC-AAAA | 6057 +----------------+----------+ 6059 13.3. Access Control Policies 6061 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6062 in this registry are strings denoting access control policies, as 6063 described in Section 6.3. New entries in this registry SHALL be 6064 registered via RFC 5226 Standards Action. The initial contents of 6065 this registry are: 6067 USER-MATCH 6068 NODE-MATCH 6069 USER-NODE-MATCH 6070 NODE-MULTIPLE 6072 13.4. Application-ID 6074 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6075 this registry are 16-bit integers denoting applictions kinds. Code 6076 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6077 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6078 registered via RFC 5226 Expert Review. Code points in the range 6079 0xf001 to 0xfffe are reserved for private us. The initial contents 6080 of this registry are: 6082 +-------------+----------------+-------------------------------+ 6083 | Application | Application-ID | Specification | 6084 +-------------+----------------+-------------------------------+ 6085 | INVALID | 0 | RFC-AAAA | 6086 | RELOAD | 1 | RFC-AAAA | 6087 | SIP | 5060 | Reserved for use by SIP Usage | 6088 | SIP | 5061 | Reserved for use by SIP Usage | 6089 | Reserved | 0xffff | RFC-AAAA | 6090 +-------------+----------------+-------------------------------+ 6092 13.5. Data Kind-ID 6094 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6095 registry are 32-bit integers denoting data kinds, as described in 6096 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 6097 SHALL be registered via RFC 5226 Standards Action. Code points in 6098 the range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 6099 Expert Review. Code points in the range 0xf0000001 to 0xffffffff are 6100 reserved for private use via the kind description mechanism described 6101 in Section 10. The initial contents of this registry are: 6103 +---------------------+------------+----------+ 6104 | Kind | Kind-ID | RFC | 6105 +---------------------+------------+----------+ 6106 | INVALID | 0 | RFC-AAAA | 6107 | TURN_SERVICE | 2 | RFC-AAAA | 6108 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6109 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6110 | Reserved | 0x7fffffff | RFC-AAAA | 6111 | Reserved | 0xffffffff | RFC-AAAA | 6112 +---------------------+------------+----------+ 6114 13.6. Data Model 6116 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6117 registry are 8-bit integers denoting data models, as described in 6118 Section 6.2. Code points in this registry SHALL be registered via 6119 RFC 5226 Standards Action. The initial contents of this registry 6120 are: 6122 +--------------+------+----------+ 6123 | Data Model | Code | RFC | 6124 +--------------+------+----------+ 6125 | INVALID | 0 | RFC-AAAA | 6126 | SINGLE_VALUE | 1 | RFC-AAAA | 6127 | ARRAY | 2 | RFC-AAAA | 6128 | DICTIONARY | 3 | RFC-AAAA | 6129 | RESERVED | 255 | RFC-AAAA | 6130 +--------------+------+----------+ 6132 13.7. Message Codes 6134 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6135 registry are 16-bit integers denoting method codes as described in 6136 Section 5.3.3. These codes SHALL be registered via RFC 5226 6137 Standards Action. The initial contents of this registry are: 6139 +---------------------------------+----------------+----------+ 6140 | Message Code Name | Code Value | RFC | 6141 +---------------------------------+----------------+----------+ 6142 | invalid | 0 | RFC-AAAA | 6143 | probe_req | 1 | RFC-AAAA | 6144 | probe_ans | 2 | RFC-AAAA | 6145 | attach_req | 3 | RFC-AAAA | 6146 | attach_ans | 4 | RFC-AAAA | 6147 | unused | 5 | | 6148 | unused | 6 | | 6149 | store_req | 7 | RFC-AAAA | 6150 | store_ans | 8 | RFC-AAAA | 6151 | fetch_req | 9 | RFC-AAAA | 6152 | fetch_ans | 10 | RFC-AAAA | 6153 | remove_req | 11 | RFC-AAAA | 6154 | remove_ans | 12 | RFC-AAAA | 6155 | find_req | 13 | RFC-AAAA | 6156 | find_ans | 14 | RFC-AAAA | 6157 | join_req | 15 | RFC-AAAA | 6158 | join_ans | 16 | RFC-AAAA | 6159 | leave_req | 17 | RFC-AAAA | 6160 | leave_ans | 18 | RFC-AAAA | 6161 | update_req | 19 | RFC-AAAA | 6162 | update_ans | 20 | RFC-AAAA | 6163 | route_query_req | 21 | RFC-AAAA | 6164 | route_query_ans | 22 | RFC-AAAA | 6165 | ping_req | 23 | RFC-AAAA | 6166 | ping_ans | 24 | RFC-AAAA | 6167 | stat_req | 25 | RFC-AAAA | 6168 | stat_ans | 26 | RFC-AAAA | 6169 | unused (was attachlite_req) | 27 | RFC-AAAA | 6170 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6171 | app_attach_req | 29 | RFC-AAAA | 6172 | app_attach_ans | 30 | RFC-AAAA | 6173 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6174 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6175 | reserved | 0x8000..0xfffe | RFC-AAAA | 6176 | error | 0xffff | RFC-AAAA | 6177 +---------------------------------+----------------+----------+ 6179 13.8. Error Codes 6181 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6182 registry are 16-bit integers denoting error codes. New entries SHALL 6183 be defined via RFC 5226 Standards Action. The initial contents of 6184 this registry are: 6186 +-------------------------------------+----------------+----------+ 6187 | Error Code Name | Code Value | RFC | 6188 +-------------------------------------+----------------+----------+ 6189 | invalid | 0 | RFC-AAAA | 6190 | Unused | 1 | RFC-AAAA | 6191 | Error_Forbidden | 2 | RFC-AAAA | 6192 | Error_Not_Found | 3 | RFC-AAAA | 6193 | Error_Request_Timeout | 4 | RFC-AAAA | 6194 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6195 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6196 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6197 | Error_Data_Too_Large | 8 | RFC-AAAA | 6198 | Error_Data_Too_Old | 9 | RFC-AAAA | 6199 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6200 | Error_Message_Too_Large | 11 | RFC-AAAA | 6201 | Error_Unknown_Kind | 12 | RFC-AAAA | 6202 | Error_Unknown_Extension | 13 | RFC-AAAA | 6203 | reserved | 0x8000..0xfffe | RFC-AAAA | 6204 +-------------------------------------+----------------+----------+ 6206 13.9. Overlay Link Types 6208 IANA shall create a "RELOAD Overlay Link." New entries SHALL be 6209 defined via RFC 5226 Standards Action. This registry SHALL be 6210 initially populated with the following values: 6212 +--------------------+------+---------------+ 6213 | Protocol | Code | Specification | 6214 +--------------------+------+---------------+ 6215 | reserved | 0 | RFC-AAAA | 6216 | DTLS-UDP-SR | 1 | RFC-AAAA | 6217 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6218 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6219 | reserved | 255 | RFC-AAAA | 6220 +--------------------+------+---------------+ 6222 13.10. Forwarding Options 6224 IANA shall create a "Forwarding Option Registry". Entries in this 6225 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6226 Action. Entries in this registry between 128 and 254 SHALL be 6227 defined via RFC 5226 Specification Required. This registry SHALL be 6228 initially populated with the following values: 6230 +-------------------+------+---------------+ 6231 | Forwarding Option | Code | Specification | 6232 +-------------------+------+---------------+ 6233 | invalid | 0 | RFC-AAAA | 6234 | reserved | 255 | RFC-AAAA | 6235 +-------------------+------+---------------+ 6237 13.11. Probe Information Types 6239 IANA shall create a "RELOAD Probe Information Type Registry". 6240 Entries in this registry SHALL be defined via RFC 5226 Standards 6241 Action. This registry SHALL be initially populated with the 6242 following values: 6244 +-----------------+------+---------------+ 6245 | Probe Option | Code | Specification | 6246 +-----------------+------+---------------+ 6247 | invalid | 0 | RFC-AAAA | 6248 | responsible_set | 1 | RFC-AAAA | 6249 | num_resources | 2 | RFC-AAAA | 6250 | uptime | 3 | RFC-AAAA | 6251 | reserved | 255 | RFC-AAAA | 6252 +-----------------+------+---------------+ 6254 13.12. Message Extensions 6256 IANA shall create a "RELOAD Extensions Registry". Entries in this 6257 registry SHALL be defined via RFC 5226 Specification Required. This 6258 registry SHALL be initially populated with the following values: 6260 +-----------------+--------+---------------+ 6261 | Extensions Name | Code | Specification | 6262 +-----------------+--------+---------------+ 6263 | invalid | 0 | RFC-AAAA | 6264 | reserved | 0xFFFF | RFC-AAAA | 6265 +-----------------+--------+---------------+ 6267 13.13. reload URI Scheme 6269 This section describes the scheme for a reload URI, which can be used 6270 to refer to either: 6272 o A peer. 6273 o A resource inside a peer. 6275 The reload URI is defined using a subset of the URI schema specified 6276 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6277 [RFC4395] per the following ABNF syntax: 6279 RELOAD-URI = "reload://" destination "@" overlay "/" 6280 [specifier] 6282 destination = 1 * HEXDIG 6283 overlay = reg-name 6284 specifier = 1*HEXDIG 6286 The definitions of these productions are as follows: 6288 destination: a hex-encoded Destination List object. 6290 overlay: the name of the overlay. 6292 specifier : a hex-encoded StoredDataSpecifier indicating the data 6293 element. 6295 If no specifier is present then this URI addresses the peer which can 6296 be reached via the indicated destination list at the indicated 6297 overlay name. If a specifier is present, then the URI addresses the 6298 data value. 6300 13.13.1. URI Registration 6302 The following summarizes the information necessary to register the 6303 reload URI. 6305 URI Scheme Name: reload 6306 Status: permanent 6307 URI Scheme Syntax: see Section 13.13 of RFC-AAAA 6308 URI Scheme Semantics: The reload URI is intended to be used as a 6309 reference to a RELOAD peer or resource. 6310 Encoding Considerations: The reload URI is not intended to be 6311 human-readable text, so it is encoded entirely in US-ASCII. 6312 Applications/protocols that use this URI scheme: The RELOAD 6313 protocol described in RFC-AAAA. 6314 Interoperability considerations See RFC-AAAA. 6315 Security considerations See RFC-AAAA 6316 Contact Cullen Jennings 6317 Author/Change controller IESG 6318 References RFC-AAAA 6320 14. Acknowledgments 6322 This specification is a merge of the "REsource LOcation And Discovery 6323 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6324 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6325 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6326 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6327 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6328 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6329 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6330 Matuszewski. Thanks to the authors of RFC 5389 for text included 6331 from that. Vidya Narayanan provided many comments and imporvements. 6333 The ideas text for the Chord specific extension data to the Leave 6334 mechanisms was provided by J. Maenpaa, G. Camarillo, and J. 6335 Hautakorp. 6337 Thanks to the many people who contributed including Ted Hardie, 6338 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6339 David Bryan, Dave Craig, and Julian Cain. Extensinve working last 6340 call comments were provided by: TODO 6342 15. References 6344 15.1. Normative References 6346 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6347 Requirement Levels", BCP 14, RFC 2119, March 1997. 6349 [I-D.ietf-mmusic-ice] 6350 Rosenberg, J., "Interactive Connectivity Establishment 6351 (ICE): A Protocol for Network Address Translator (NAT) 6352 Traversal for Offer/Answer Protocols", 6353 draft-ietf-mmusic-ice-19 (work in progress), October 2007. 6355 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 6356 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 6357 October 2008. 6359 [I-D.ietf-behave-turn] 6360 Rosenberg, J., Mahy, R., and P. Matthews, "Traversal Using 6361 Relays around NAT (TURN): Relay Extensions to Session 6362 Traversal Utilities for NAT (STUN)", 6363 draft-ietf-behave-turn-16 (work in progress), July 2009. 6365 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6366 (CMC): Transport Protocols", RFC 5273, June 2008. 6368 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6369 (CMC)", RFC 5272, June 2008. 6371 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6372 for Transport Layer Security (TLS)", RFC 4279, 6373 December 2005. 6375 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6376 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6378 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6379 Security", RFC 4347, April 2006. 6381 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 6382 Friendly Rate Control (TFRC): Protocol Specification", 6383 RFC 5348, September 2008. 6385 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6386 Encodings", RFC 4648, October 2006. 6388 [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission 6389 Timer", RFC 2988, November 2000. 6391 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6392 Resource Identifier (URI): Generic Syntax", STD 66, 6393 RFC 3986, January 2005. 6395 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6396 Registration Procedures for New URI Schemes", BCP 35, 6397 RFC 4395, February 2006. 6399 15.2. Informative References 6401 [I-D.ietf-mmusic-ice-tcp] 6402 Rosenberg, J., "TCP Candidates with Interactive 6403 Connectivity Establishment (ICE)", 6404 draft-ietf-mmusic-ice-tcp-07 (work in progress), 6405 July 2008. 6407 [I-D.maenpaa-p2psip-self-tuning] 6408 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 6409 tuning Distributed Hash Table (DHT) for REsource LOcation 6410 And Discovery (RELOAD)", 6411 draft-maenpaa-p2psip-self-tuning-01 (work in progress), 6412 October 2009. 6414 [I-D.baset-tsvwg-tcp-over-udp] 6415 Baset, S. and H. Schulzrinne, "TCP-over-UDP", 6416 draft-baset-tsvwg-tcp-over-udp-01 (work in progress), 6417 June 2009. 6419 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 6420 "Host Identity Protocol", RFC 5201, April 2008. 6422 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 6423 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 6424 April 2007. 6426 [I-D.ietf-p2psip-concepts] 6427 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 6428 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 6429 draft-ietf-p2psip-concepts-02 (work in progress), 6430 July 2008. 6432 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6433 Communication Layers", STD 3, RFC 1122, October 1989. 6435 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 6436 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 6437 RFC 5382, October 2008. 6439 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 6440 the Session Description Protocol (SDP)", RFC 4145, 6441 September 2005. 6443 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6445 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6446 Requirements for Security", BCP 106, RFC 4086, June 2005. 6448 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 6449 "Using the Secure Remote Password (SRP) Protocol for TLS 6450 Authentication", RFC 5054, November 2007. 6452 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6453 Housley, R., and W. Polk, "Internet X.509 Public Key 6454 Infrastructure Certificate and Certificate Revocation List 6455 (CRL) Profile", RFC 5280, May 2008. 6457 [I-D.matthews-p2psip-bootstrap-mechanisms] 6458 Cooper, E., "Bootstrap Mechanisms for P2PSIP", 6459 draft-matthews-p2psip-bootstrap-mechanisms-00 (work in 6460 progress), February 2007. 6462 [I-D.garcia-p2psip-dns-sd-bootstrapping] 6463 Garcia, G., "P2PSIP bootstrapping using DNS-SD", 6464 draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in 6465 progress), October 2007. 6467 [I-D.pascual-p2psip-clients] 6468 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 6469 Yongchao, "P2PSIP Clients", 6470 draft-pascual-p2psip-clients-01 (work in progress), 6471 February 2008. 6473 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 6474 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 6475 RFC 4787, January 2007. 6477 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 6478 L. Repka, "S/MIME Version 2 Message Specification", 6479 RFC 2311, March 1998. 6481 [I-D.jiang-p2psip-sep] 6482 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 6483 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 6484 February 2008. 6486 [I-D.hardie-p2poverlay-pointers] 6487 Hardie, T., "Mechanisms for use in pointing to overlay 6488 networks, nodes, or resources", 6489 draft-hardie-p2poverlay-pointers-00 (work in progress), 6490 January 2008. 6492 [I-D.ietf-p2psip-sip] 6493 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 6494 H. Schulzrinne, "A SIP Usage for RELOAD", 6495 draft-ietf-p2psip-sip-01 (work in progress), March 2009. 6497 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 6499 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 6500 "Eclipse Attacks on Overlay Networks: Threats and 6501 Defenses", INFOCOM 2006, April 2006. 6503 [non-transitive-dhts-worlds05] 6504 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 6505 Stoica, "Non-Transitive Connectivity and DHTs", 6506 WORLDS'05. 6508 [lookups-churn-p2p06] 6509 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 6510 Improving DHT Lookup Performance under Churn", IEEE 6511 P2P'06. 6513 [bryan-design-hotp2p08] 6514 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 6515 a Versatile, Secure P2PSIP Communications Architecture for 6516 the Public Internet", Hot-P2P'08. 6518 [opendht-sigcomm05] 6519 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 6520 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 6521 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 6523 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 6524 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 6525 Scalable Peer-to-peer Lookup Protocol for Internet 6526 Applications", IEEE/ACM Transactions on Networking Volume 6527 11, Issue 1, 17-32, Feb 2003. 6529 [vulnerabilities-acsac04] 6530 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 6531 Threats in Structured Peer-to-Peer Systems: A Quantitative 6532 Analysis", ACSAC 2004. 6534 [I-D.irtf-p2prg-rtc-security] 6535 Schulzrinne, H., Marocco, E., and E. Ivov, "Security 6536 Issues and Solutions in Peer-to-peer Systems for Realtime 6537 Communications", draft-irtf-p2prg-rtc-security-05 (work in 6538 progress), September 2009. 6540 [handling-churn-usenix04] 6541 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 6542 "Handling Churn in a DHT", USENIX 2004. 6544 [minimizing-churn-sigcomm06] 6545 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 6546 in Distributed Systems", SIGCOMM 2006. 6548 Appendix A. Change Log 6550 A.1. Changes since draft-ietf-p2psip-reload-04 6552 o Renamed the XML element in configuration files from to . 6555 A.2. Changes since draft-ietf-p2psip-reload-01 6557 o Added the ability to introduce new kinds dynamically. 6558 o Added configuration file updating. 6559 o Major revisions to reliability and flow control algorithms. 6560 o Moved diagnostics out--they now go in a separate draft. 6562 o Removed REMOVE: you now store a "nonexistent" element. 6564 A.3. Changes since draft-ietf-p2psip-reload-00 6566 o Split base protocol from combined draft into new draft. 6567 o Update architecture discussion to address concerns raised about 6568 clarity of roles. 6569 o Moved extensive discussion of routing and client behaviors to 6570 appendix. 6571 o Split Ping into Ping and Probe. 6572 o Added AttachLite to provide way to implement ICE-Lite. 6573 o Added Stat call for retrieving meta-data. 6574 o Added discussion of periodic vs reactive recovery issue. 6575 o Changed finger table stabilization to prefer long-lived over best- 6576 match. 6577 o Updated IANA considerations to be more complete. 6578 o Changed error codes from http-based. 6580 A.4. Changes since draft-ietf-p2psip-base-00 6582 o Removed TUNNEL method 6583 o Allow implementations more flexibility in picking finger table 6584 entries and revising random range. 6585 o Decouple overlay configuration from enrollment server. 6586 o Add error for data too large. 6587 o Change architecture to overlay perspective from previous revision 6588 and update terminology in document to match. 6590 A.5. Changes since draft-ietf-p2psip-base-01 6592 o Reordered message routing section to clarify that other routing 6593 algorithms are possible besides symmetric recursive. 6594 o Clarified document IPR terms. 6596 A.6. Changes since draft-ietf-p2psip-base-01a 6598 o Fragment offset was too small to hold 2^24 bit messages, so fixed 6599 this from 16 bits to 32 bits. 6600 o Changed absolute times from seconds to milliseconds. 6601 o Added error for messages over max size. 6602 o Added error for TTL expired. 6603 o Add time in response to PING. 6604 o Clarified retransmission and fragmentation algorithm. 6605 o Clarified acknowledgement tracking for congestion control. 6607 A.7. Changes since draft-ietf-p2psip-base-02 6609 o Rearranged forwarding header to fix alignment, among other issues. 6610 o Removed route logging. 6611 o Switched to binary ICE for Attach. 6612 o ConfigUpdate improved. 6613 o Change from close DTLS session on fragmentation attack to drop 6614 fragments, indirect attack. 6615 o Updates to trivial sender/receiver text. 6616 o Updates to data model based on list discussion. 6617 o Updates to chord overlay algorithm section. 6618 o Added AppAttach and removed port number from Attach. 6619 o Changed via-list to use shorter structure. 6620 o Rewrote fragmentation. 6621 o Moved AIMD and TFRC congestion control algorithms to appendix 6622 until further WG effort decides direction there. 6624 Appendix B. Routing Alternatives 6626 Significant discussion has been focused on the selection of a routing 6627 algorithm for P2PSIP. This section discusses the motivations for 6628 selecting symmetric recursive routing for RELOAD and describes the 6629 extensions that would be required to support additional routing 6630 algorithms. 6632 B.1. Iterative vs Recursive 6634 Iterative routing has a number of advantages. It is easier to debug, 6635 consumes fewer resources on intermediate peers, and allows the 6636 querying peer to identify and route around misbehaving peers 6637 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 6638 iterative routing is intolerably expensive because a new connection 6639 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 6641 Iterative routing is supported through the Route_Query mechanism and 6642 is primarily intended for debugging. It also allows the querying 6643 peer to evaluate the routing decisions made by the peers at each hop, 6644 consider alternatives, and perhaps detect at what point the 6645 forwarding path fails. 6647 B.2. Symmetric vs Forward response 6649 An alternative to the symmetric recursive routing method used by 6650 RELOAD is Forward-Only routing, where the response is routed to the 6651 requester as if it were a new message initiated by the responder (in 6652 the previous example, Z sends the response to A as if it were sending 6653 a request). Forward-only routing requires no state in either the 6654 message or intermediate peers. 6656 The drawback of forward-only routing is that it does not work when 6657 the overlay is unstable. For example, if A is in the process of 6658 joining the overlay and is sending a Join request to Z, it is not yet 6659 reachable via forward routing. Even if it is established in the 6660 overlay, if network failures produce temporary instability, A may not 6661 be reachable (and may be trying to stabilize its network connectivity 6662 via Attach messages). 6664 Furthermore, forward-only responses are less likely to reach the 6665 querying peer than symmetric recursive ones are, because the forward 6666 path is more likely to have a failed peer than is the request path 6667 (which was just tested to route the request) 6668 [non-transitive-dhts-worlds05]. 6670 An extension to RELOAD that supports forward-only routing but relies 6671 on symmetric responses as a fallback would be possible, but due to 6672 the complexities of determining when to use forward-only and when to 6673 fallback to symmetric, we have chosen not to include it as an option 6674 at this point. 6676 B.3. Direct Response 6678 Another routing option is Direct Response routing, in which the 6679 response is returned directly to the querying node. In the previous 6680 example, if A encodes its IP address in the request, then Z can 6681 simply deliver the response directly to A. In the absence of NATs or 6682 other connectivity issues, this is the optimal routing technique. 6684 The challenge of implementing direct response is the presence of 6685 NATs. There are a number of complexities that must be addressed. In 6686 this discussion, we will continue our assumption that A issued the 6687 request and Z is generating the response. 6689 o The IP address listed by A may be unreachable, either due to NAT 6690 or firewall rules. Therefore, a direct response technique must 6691 fallback to symmetric response [non-transitive-dhts-worlds05]. 6692 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 6693 received the message (and the TLS negotiation will provide earlier 6694 confirmation that A is reachable), but this fallback requires a 6695 timeout that will increase the response latency whenever A is not 6696 reachable from Z. 6697 o Whenever A is behind a NAT it will have multiple candidate IP 6698 addresses, each of which must be advertised to ensure 6699 connectivity; therefore Z will need to attempt multiple 6700 connections to deliver the response. 6702 o One (or all) of A's candidate addresses may route from Z to a 6703 different device on the Internet. In the worst case these nodes 6704 may actually be running RELOAD on the same port. Therefore, it is 6705 absolutely necessary to establish a secure connection to 6706 authenticate A before delivering the response. This step 6707 diminishes the efficiency of direct response because multiple 6708 roundtrips are required before the message can be delivered. 6709 o If A is behind a NAT and does not have a connection already 6710 established with Z, there are only two ways the direct response 6711 will work. The first is that A and Z both be behind the same NAT, 6712 in which case the NAT is not involved. In the more common case, 6713 when Z is outside A's NAT, the response will only be received if 6714 A's NAT implements endpoint-independent filtering. As the choice 6715 of filtering mode conflates application transparency with security 6716 [RFC4787], and no clear recommendation is available, the 6717 prevalence of this feature in future devices remains unclear. 6719 An extension to RELOAD that supports direct response routing but 6720 relies on symmetric responses as a fallback would be possible, but 6721 due to the complexities of determining when to use direct response 6722 and when to fallback to symmetric, and the reduced performance for 6723 responses to peers behind restrictive NATs, we have chosen not to 6724 include it as an option at this point. 6726 B.4. Relay Peers 6728 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 6729 response by having A identify a peer, Q, that will be directly 6730 reachable by any other peer. A uses Attach to establish a connection 6731 with Q and advertises Q's IP address in the request sent to Z. Z 6732 sends the response to Q, which relays it to A. This then reduces the 6733 latency to two hops, plus Z negotiating a secure connection to Q. 6735 This technique relies on the relative population of nodes such as A 6736 that require relay peers and peers such as Q that are capable of 6737 serving as a relay peer. It also requires nodes to be able to 6738 identify which category they are in. This identification problem has 6739 turned out to be hard to solve and is still an open area of 6740 exploration. 6742 An extension to RELOAD that supports relay peers is possible, but due 6743 to the complexities of implementing such an alternative, we have not 6744 added such a feature to RELOAD at this point. 6746 A concept similar to relay peers, essentially choosing a relay peer 6747 at random, has previously been suggested to solve problems of 6748 pairwise non-transitivity [non-transitive-dhts-worlds05], but 6749 deterministic filtering provided by NATs makes random relay peers no 6750 more likely to work than the responding peer. 6752 B.5. Symmetric Route Stability 6754 A common concern about symmetric recursive routing has been that one 6755 or more peers along the request path may fail before the response is 6756 received. The significance of this problem essentially depends on 6757 the response latency of the overlay. An overlay that produces slow 6758 responses will be vulnerable to churn, whereas responses that are 6759 delivered very quickly are vulnerable only to failures that occur 6760 over that small interval. 6762 The other aspect of this issue is whether the request itself can be 6763 successfully delivered. Assuming typical connection maintenance 6764 intervals, the time period between the last maintenance and the 6765 request being sent will be orders of magnitude greater than the delay 6766 between the request being forwarded and the response being received. 6767 Therefore, if the path was stable enough to be available to route the 6768 request, it is almost certainly going to remain available to route 6769 the response. 6771 An overlay that is unstable enough to suffer this type of failure 6772 frequently is unlikely to be able to support reliable functionality 6773 regardless of the routing mechanism. However, regardless of the 6774 stability of the return path, studies show that in the event of high 6775 churn, iterative routing is a better solution to ensure request 6776 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 6778 Finally, because RELOAD retries the end-to-end request, that retry 6779 will address the issues of churn that remain. 6781 Appendix C. Why Clients? 6783 There are a wide variety of reasons a node may act as a client rather 6784 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 6785 some of those scenarios and how the client's behavior changes based 6786 on its capabilities. 6788 C.1. Why Not Only Peers? 6790 For a number of reasons, a particular node may be forced to act as a 6791 client even though it is willing to act as a peer. These include: 6793 o The node does not have appropriate network connectivity, typically 6794 because it has a low-bandwidth network connection. 6796 o The node may not have sufficient resources, such as computing 6797 power, storage space, or battery power. 6798 o The overlay algorithm may dictate specific requirements for peer 6799 selection. These may include participating in the overlay to 6800 determine trustworthiness; controlling the number of peers in the 6801 overlay to reduce overly-long routing paths; or ensuring minimum 6802 application uptime before a node can join as a peer. 6804 The ultimate criteria for a node to become a peer are determined by 6805 the overlay algorithm and specific deployment. A node acting as a 6806 client that has a full implementation of RELOAD and the appropriate 6807 overlay algorithm is capable of locating its responsible peer in the 6808 overlay and using Attach to establish a direct connection to that 6809 peer. In that way, it may elect to be reachable under either of the 6810 routing approaches listed above. Particularly for overlay algorithms 6811 that elect nodes to serve as peers based on trustworthiness or 6812 population, the overlay algorithm may require such a client to locate 6813 itself at a particular place in the overlay. 6815 C.2. Clients as Application-Level Agents 6817 SIP defines an extensive protocol for registration and security 6818 between a client and its registrar/proxy server(s). Any SIP device 6819 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 6820 peer that implements the server-side functionality required by the 6821 SIP protocol. In this case, the peer would be acting as if it were 6822 the user's peer, and would need the appropriate credentials for that 6823 user. 6825 Application-level support for clients is defined by a usage. A usage 6826 offering support for application-level clients should specify how the 6827 security of the system is maintained when the data is moved between 6828 the application and RELOAD layers. 6830 Authors' Addresses 6832 Cullen Jennings 6833 Cisco 6834 170 West Tasman Drive 6835 MS: SJC-21/2 6836 San Jose, CA 95134 6837 USA 6839 Phone: +1 408 421-9990 6840 Email: fluffy@cisco.com 6841 Bruce B. Lowekamp (editor) 6842 Skype 6843 Palo Alto, CA 6844 USA 6846 Email: bbl@lowekamp.net 6848 Eric Rescorla 6849 Network Resonance 6850 2064 Edgewood Drive 6851 Palo Alto, CA 94303 6852 USA 6854 Phone: +1 650 320-8549 6855 Email: ekr@networkresonance.com 6857 Salman A. Baset 6858 Columbia University 6859 1214 Amsterdam Avenue 6860 New York, NY 6861 USA 6863 Email: salman@cs.columbia.edu 6865 Henning Schulzrinne 6866 Columbia University 6867 1214 Amsterdam Avenue 6868 New York, NY 6869 USA 6871 Email: hgs@cs.columbia.edu