Changeset 11182 for dotorg/trunk

Show
Ignore:
Timestamp:
10/15/09 19:42:16 (5 months ago)
Author:
bittorrent
Message:

updated bep 32

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dotorg/trunk/html/beps/bep_0032.rst

    r11178 r11182  
    99Content-Type: text/x-rst 
    1010Created: 14-Oct-2009 
    11 Post-History:  
     11Post-History: 15-Oct-2009: Promote same ID in IPv6 and IPv4 nodes. Drop values6. Added some rationales 
    1212 
    1313 
     
    1818to allow operation over IPv6. 
    1919 
    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. 
    2121 
    2222 
     
    3838version of the BitTorrent DHT. 
    3939 
    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. 
     40The extension described in this document also solves a long-standing 
     41issue with the protocol defined in BEP-5.  The presence of contact 
     42information in the reply is no longer governed by the presence of 
     43a "values" key; this avoids the well-known problem of contact 
     44information being masked by peer information.  While this is an 
     45incompatible change, it is believed to be properly handled by all 
     46deployed implementations. 
    4647 
    4748 
     
    5455IPv4 DHT, and, conversely, no IPv4 data is stored in the IPv6 DHT.  A node 
    5556wishing 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. 
     57tables, one for IPv4 and one for IPv6. 
     58 
     59While this is not strictly necessary, a node should use the same node 
     60id in both tables.  This simplifies implementation and debugging, and 
     61slightly increases efficiency in the case where the two DHTs are 
     62mostly congruent. 
    6363 
    6464By default, messages only carry data in the address family implied by the 
     
    7373A single-protocol node (IPv4 or IPv6) only participates in one DHT.  Such 
    7474a node does not need to explicitly request data in a given family -- the 
    75 data provided by default is sufficient. 
     75data provided by default is exactly what it needs. 
    7676 
    7777 
     
    8080 
    8181While 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 of 
    83 the protocol to make its operation more efficient and to generally improve 
    84 the reliability of the DHT. 
     82a double-stack (IPv4 and IPv6) node can make bootstrap faster and 
     83improve the reliability of the protocol by "leaking" data between the 
     84two DHTs, as described in the following paragraphs. 
    8585 
    8686 
     
    9393 
    9494 
    95 Stationary operation 
    96 '''''''''''''''''''' 
    97  
    98 Once bootstrap is successful, a node should not request data in both 
    99 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 network traffic. 
     95Steady-state operation 
     96'''''''''''''''''''''' 
     97 
     98Once bootstrap is successful, a node should normally only request 
     99"nodes" replies from IPv4 nodes, and "nodes6" replies from IPv6 nodes. 
     100Requesting both address families in all requests is unlikely to 
     101provide useful information, and hence uselessly increases network 
     102traffic. 
    103103 
    104104In 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 an 
    106 IPv6 node, or a request for "nodes6" to an IPv4 node. 
     105network 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. 
    107107 
    108108 
     
    110110=========================================== 
    111111 
     112Changes to existing parameters 
     113------------------------------ 
     114 
     115values 
     116'''''' 
     117 
     118In a reply sent over IPv4, the "values" parameter contains a list of 
     119strings, each of which contains compact format IPv4 contact 
     120information for a single peer. 
     121 
     122In a reply sent over IPv6, "values' contains a list of strings, each 
     123of which contains compact format IPv6 contact information for a single 
     124peer. 
     125 
     126Implementations of this specification must be able to properly parse 
     127hybrid "values" lists -- lists containing an arbitrary mixture of 
     1286-octet IPv4 values and 18-octet IPv6 values.  However, 
     129implementations should not send such hybrid lists, and must not send 
     130hybrid lists in a reply to an IPv4 request that doesn't contain 
     131a "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 
    112138New parameters 
    113139-------------- 
     
    116142'''''' 
    117143 
    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. 
     144The "nodes6" parameter is analogous to the existing "nodes" parameter: 
     145when present, it carries a string containing the compact IPv6 node 
     146info for the 8 closest good nodes in the sending node's IPv6 routing 
     147table.  This parameter is allowed in replies to the find_nodes and 
     148get_peers messages (see below). 
    130149 
    131150 
     
    145164and must be silently ignored on reception. 
    146165 
     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 
    147171 
    148172Changes to message semantics 
     
    152176'''''''''''''''''''''''' 
    153177 
    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. 
     178A node sending a find_nodes or get_peers request should include 
     179a "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 
     181include a "nodes" parameter if and only if the request's "want" 
     182parameter included a "4", and should include a "nodes6" parameter if 
     183and only if the request's "want" parameter included a "6". 
     184 
     185In the absence of a "want" parameter, the reply should include "nodes" 
     186if the request was sent over IPv4, and should include "nodes6" if the 
     187request 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 
     195When a node receives a get_peers request and it has contact 
     196information for the matching address family and info-hash, it should 
     197additionally include a "values" parameter containing a list of 6-octet 
     198strings if the request was sent over IPv4, and a list of 18-octet 
     199strings if the request was sent over IPv6. 
     200 
     201A reply sent over IPv4 should not contain 18-octet IPv6 contact 
     202information, and a reply sent over IPv6 should not contain 6-octet 
     203IPv4 contact information.  In other words, the "want" parameter only 
     204governs the presence of the "nodes" and "nodes6" parameters, not the 
     205interpretation 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. 
    185213 
    186214 
     
    197225================ 
    198226 
    199 I gratefully acknowledge the influence of *The 8472* over this work. 
     227I gratefully acknowledge the influence of *The 8472* and *arvid* over 
     228this work. 
    200229 
    201230