Changeset 11182
- Timestamp:
- 10/15/09 19:42:16 (10 months ago)
- File:
-
- 1 edited
-
dotorg/trunk/html/beps/bep_0032.rst (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dotorg/trunk/html/beps/bep_0032.rst
r11178 r11182 9 9 Content-Type: text/x-rst 10 10 Created: 14-Oct-2009 11 Post-History: 11 Post-History: 15-Oct-2009: Promote same ID in IPv6 and IPv4 nodes. Drop values6. Added some rationales 12 12 13 13 … … 18 18 to allow operation over IPv6. 19 19 20 **This is a very early draft**, and not suitable for implementation. Yet.20 **This is a very early draft**, and **not suitable for implementation**. Yet. 21 21 22 22 … … 38 38 version of the BitTorrent DHT. 39 39 40 The extension described in this document also solves a long-standing issue 41 with the protocol defined in BEP-5, and does so without endangering 42 compatibility. When a get_peers request is sent with an explicit request 43 for an address family, the presence of contact information in the reply is 44 no longer governed by the presence of a "values" key; this avoids the 45 well-known problem of contact information being masked by peer information. 40 The extension described in this document also solves a long-standing 41 issue with the protocol defined in BEP-5. The presence of contact 42 information in the reply is no longer governed by the presence of 43 a "values" key; this avoids the well-known problem of contact 44 information being masked by peer information. While this is an 45 incompatible change, it is believed to be properly handled by all 46 deployed implementations. 46 47 47 48 … … 54 55 IPv4 DHT, and, conversely, no IPv4 data is stored in the IPv6 DHT. A node 55 56 wishing to participate in both DHTs must maintain two distinct routing 56 tables, one for IPv4 and one for IPv6. A node may choose to use the same 57 node id in both tables, or distinct node ids. 58 59 Most KRPC messages have the same semantics when carried over IPv4 and IPv6. 60 In particular, no IPv6 addresses are ever carried in the existing "nodes" 61 and "peers" keys of KRPC messages -- instead, new keys "nodes6" and 62 "peers6" are defined. 57 tables, one for IPv4 and one for IPv6. 58 59 While this is not strictly necessary, a node should use the same node 60 id in both tables. This simplifies implementation and debugging, and 61 slightly increases efficiency in the case where the two DHTs are 62 mostly congruent. 63 63 64 64 By default, messages only carry data in the address family implied by the … … 73 73 A single-protocol node (IPv4 or IPv6) only participates in one DHT. Such 74 74 a node does not need to explicitly request data in a given family -- the 75 data provided by default is sufficient.75 data provided by default is exactly what it needs. 76 76 77 77 … … 80 80 81 81 While conceptually equivalent to a pair of single-protocol nodes, 82 a double-stack (IPv4 and IPv6) node can make use of a number of features of83 the protocol to make its operation more efficient and to generally improve84 t he reliability of the DHT.82 a double-stack (IPv4 and IPv6) node can make bootstrap faster and 83 improve the reliability of the protocol by "leaking" data between the 84 two DHTs, as described in the following paragraphs. 85 85 86 86 … … 93 93 94 94 95 St ationaryoperation96 '''''''''''''''''''' 97 98 Once bootstrap is successful, a node should no t request data in both99 address families; it should only request "nodes" replies from IPv4 nodes, 100 and "nodes6" replies from IPv6 nodes. Requesting both address families is 101 unlikely to provide any useful information, and unnecessarily increases 102 networktraffic.95 Steady-state operation 96 '''''''''''''''''''''' 97 98 Once bootstrap is successful, a node should normally only request 99 "nodes" replies from IPv4 nodes, and "nodes6" replies from IPv6 nodes. 100 Requesting both address families in all requests is unlikely to 101 provide useful information, and hence uselessly increases network 102 traffic. 103 103 104 104 In order to increase the reliability of the DHT after a single-protocol 105 network outage, a node may *ocasionally* send a request for "nodes" to an106 IPv6 node, or a request for "nodes6" to an IPv4 node.105 network outage, however, a node may *ocasionally* send a request for 106 "nodes" to an IPv6 node, or a request for "nodes6" to an IPv4 node. 107 107 108 108 … … 110 110 =========================================== 111 111 112 Changes to existing parameters 113 ------------------------------ 114 115 values 116 '''''' 117 118 In a reply sent over IPv4, the "values" parameter contains a list of 119 strings, each of which contains compact format IPv4 contact 120 information for a single peer. 121 122 In a reply sent over IPv6, "values' contains a list of strings, each 123 of which contains compact format IPv6 contact information for a single 124 peer. 125 126 Implementations of this specification must be able to properly parse 127 hybrid "values" lists -- lists containing an arbitrary mixture of 128 6-octet IPv4 values and 18-octet IPv6 values. However, 129 implementations should not send such hybrid lists, and must not send 130 hybrid lists in a reply to an IPv4 request that doesn't contain 131 a "want" parameter. 132 133 **Rationale**: a request sent over IPv4 with no "want" parameter 134 could originate from a node that implements plain BEP-5, and which 135 might therefore be unable to parse a hybrid list. 136 137 112 138 New parameters 113 139 -------------- … … 116 142 '''''' 117 143 118 The "nodes6" parameter is allowed in replies to the find_nodes and 119 get_peers messages. When present, it carries a string containing the 120 compact IPv6 node info for the 8 closest good nodes in the sending node's 121 IPv6 routing table. 122 123 124 values6 125 ''''''' 126 127 The "values6" parameter is allowed in replies to the get_peers message 128 being sent over IPv6. Its value is a list of strings, each of which 129 contains compact format IPv6 contact information for a single peer. 144 The "nodes6" parameter is analogous to the existing "nodes" parameter: 145 when present, it carries a string containing the compact IPv6 node 146 info for the 8 closest good nodes in the sending node's IPv6 routing 147 table. This parameter is allowed in replies to the find_nodes and 148 get_peers messages (see below). 130 149 131 150 … … 145 164 and must be silently ignored on reception. 146 165 166 **Note**: the "want" parameter is currently under discussion. It 167 has been suggested that it should be renamed to "flags", and that 168 it should be a list of flags rather than a string. This author 169 is not convinced yet. 170 147 171 148 172 Changes to message semantics … … 152 176 '''''''''''''''''''''''' 153 177 154 A node sending a find_nodes or get_peers request should include a "want" 155 parameter containing one or both of the characters "4" or "6". A node 156 replying to a find_nodes or get_peers request must include a "nodes" 157 parameter if the request's "want" parameter included a "4", and a "nodes6" 158 parameter if the request's "want" parameter included a "6". 159 160 In the absence of a "want" parameter, the behaviour of the replying node is 161 more involved. For a reply to a find_nodes request, the node should 162 include "nodes" if the request was sent over IPv4, and include "nodes6" if 163 the request was sent over IPv6. 164 165 For a get_peers request with no "want" parameter, value should only be 166 included if there is no "values" or "values6" parameter. If no "values" or 167 "values6" parameter is being sent, the presence of "nodes" or "nodes6" is 168 governed by the network-layer protocol of the request, as above. 169 170 **Rationale**: it has been suggested that the reply to a get_peers 171 request should always include a "nodes" or "nodes6" parameter, 172 independently of the presence of a "values" or "values6" parameter. 173 While this is clearly a better semantics, it is not backward-compatible, 174 and it is not known whether it breaks any deployed implementations. 175 176 When a node receives a get_peers request and it has contact information for 177 the matching address family and info-hash, it should include either 178 a "values" parameter (if the request was sent over IPv4) or a "values6" 179 parameter in the reply. 180 181 A reply sent over IPv4 must not contain a "values6" parameter, and a reply 182 sent over IPv6 must not contain a "values" parameter. In other words, the 183 "want" parameter only governs the presence of the "nodes" and "nodes6" 184 parameters. 178 A node sending a find_nodes or get_peers request should include 179 a "want" parameter containing one or both of the characters "4" or 180 "6". A node replying to a find_nodes or get_peers request should 181 include a "nodes" parameter if and only if the request's "want" 182 parameter included a "4", and should include a "nodes6" parameter if 183 and only if the request's "want" parameter included a "6". 184 185 In the absence of a "want" parameter, the reply should include "nodes" 186 if the request was sent over IPv4, and should include "nodes6" if the 187 request was sent over IPv6. 188 189 **Rationale**: this is an incompatible change to the protocol 190 defined in BEP-5 [#BEP-5]_, which specifies that "nodes" and 191 "values" are mutually exclusive. However, this change makes the DHT 192 more reliable, and has been deployed by most implementations for 193 over a year with no negative effects. 194 195 When a node receives a get_peers request and it has contact 196 information for the matching address family and info-hash, it should 197 additionally include a "values" parameter containing a list of 6-octet 198 strings if the request was sent over IPv4, and a list of 18-octet 199 strings if the request was sent over IPv6. 200 201 A reply sent over IPv4 should not contain 18-octet IPv6 contact 202 information, and a reply sent over IPv6 should not contain 6-octet 203 IPv4 contact information. In other words, the "want" parameter only 204 governs the presence of the "nodes" and "nodes6" parameters, not the 205 interpretation of "values". 206 207 **Rationale**: if the requesting node is a single-stack node, it has 208 no interest in values of the other address family. If the 209 requesting node is a double-stack node, then it must perform the two 210 announces in parallel; providing both sets of data in both sets of 211 replies merely increases the amount of traffic without giving any 212 extra information. 185 213 186 214 … … 197 225 ================ 198 226 199 I gratefully acknowledge the influence of *The 8472* over this work. 227 I gratefully acknowledge the influence of *The 8472* and *arvid* over 228 this work. 200 229 201 230
Note: See TracChangeset
for help on using the changeset viewer.