REsource LOcation And Discovery (RELOAD) Cisco
170 West Tasman Drive MS: SJC-21/2 San Jose CA 95134 USA +1 408 421-9990 fluffy@cisco.com
SIPeerior Technologies
3000 Easter Circle Williamsburg VA 23188 USA +1 757 565 0101 lowekamp@sipeerior.com
Network Resonance
2064 Edgewood Drive Palo Alto CA 94303 USA +1 650 320-8549 ekr@networkresonance.com
Columbia University
1214 Amsterdam Avenue New York NY USA salman@cs.columbia.edu
Columbia University
1214 Amsterdam Avenue New York NY USA hgs@cs.columbia.edu
RAI P2PSIP This document defines REsource LOcation And Discovery (RELOAD), a peer-to-peer (P2P) binary signaling protocol for use on the Internet. A P2P signaling protocol provides its clients with an abstract hash table service between a set of cooperating peers that form the overlay network. RELOAD is designed to support a P2P Session Initiation Protocol (P2PSIP) network, but can be utilized by other applications with similar requirements by defining new usages that specify the data kinds that must be stored for a particular application. RELOAD defines a security model based on a certificate enrollment service that provides unique identities. NAT traversal is a fundamental service of the protocol. RELOAD also allows access from "client" nodes which do not need to route traffic or store data for others.
This document defines REsource LOcation And Discovery (RELOAD), a peer-to-peer (P2P) signaling protocol for use on the Internet. It provides a generic, self-organizing overlay network service, allowing nodes to efficiently route messages to other nodes based on node-id and to efficiently store and retrieve data in the overlay. RELOAD is a lightweight, binary protocol. It provides several functions that are critical for a successful P2P protocol for the Internet: A P2P network will often be established among a set of peers that do not trust each other. RELOAD leverages a central enrollment to provide credentials for each peer which can then be used to authenticate each operation. This greatly reduces the possible attack surface. RELOAD is designed to support a variety of applications, including P2P multimedia communications with the Session Initiation Protocol . RELOAD allows the definition of new application usages, each of which can define its own data types, along with the rules for their use. This allows RELOAD to be used with new applications through a simple documentation process that supplies the details for each application. RELOAD is designed to function in environments where many if not most of the nodes are behind NATs or firewalls. Operations for NAT traversal are part of the base design, including establishing new RELOAD connections and tunneling SIP or other application protocols required by P2PSIP. The very nature of DHT algorithms introduces a requirement that peers participating in the P2P network route requests on behalf of other peers in the network. This introduces a load on those other peers, in the form of bandwidth and processing power. RELOAD has been defined with a simple, lightweight forwarding header, thus minimizing the amount of effort required by intermediate peers. RELOAD has been designed with an abstract interface to the overlay layer to simplify implementing a variety of structured (DHT) and unstructured overlay algorithms. This specification also defines how RELOAD is used with Chord, which is mandatory to implement. Specifying a default "must implement" DHT will allow interoperability, while the extensibility allows selection of DHTs optimized for a particular application. These properties were designed specifically to meet the requirements for a P2P protocol to support SIP, and this document defines a SIP Usage of RELOAD. However, RELOAD is not limited to usage by SIP and could serve as a tool for supporting other P2P applications with similar needs. RELOAD is also based on the concepts introduced in .
Architecturally this specification is divided into several layers, as shown in the following figure.
| Storage | | | +---------+ | Routing | ^ | Layer | v | | +---------+ | |<->|Topology | | | | Plugin | +------------------+ +---------+ ^ ^ v | +------------------+ <------+ | Forwarding | | Layer | +------------------+ -------------------------------------- Transport API +-------+ +------+ |TLS | |DTLS | ... +-------+ +------+ ]]>
The major components of RELOAD are: Each application defines reload usage: a set of data kinds and behaviors which describe how to use the services provided by RELOAD. These usages all talk to RELOAD through a common message routing API. The Routing Layer is responsible for routing messages through the overlay. It talks directly to the topology plugin, which is responsible for implementing the specific topology defined by the DHT being used. The Storage component is responsible for processing messages relating to the storage and retrieval of data. It talks directly to the topology plugin and the routing layer in order to send and receive messages and manage data replication. The Topology Plugin is responsible for implementing the specific topology defined by the DHT being used. It talks directly to the Routing Layer to send and receive overlay management messages and to the Storage component to manage data replication. The Forwarding Layer provides packet forwarding services between nodes. It also handles setting up connections across NATs using ICE.
The top layer, called the Usage Layer, has application usages, such as the SIP Location Usage, that use the abstract Message Routing API provided by RELOAD. The goal of this layer is to implement application-specific usages of the overlay services provided by RELOAD. The Usage defines how a specific application maps its data into something that can be stored in the DHT, where to store the data, how to secure the data, and finally how applications can retrieve and use the data. The architecture diagram shows both a SIP usage and an XMPP usage. A single application may require multiple usages. A usage may define multiple kinds of data that are stored in the overlay and may also rely on kinds originally defined by other usages. A usage is not itself encoded on the wire, only the kind-ids and data models are, but is rather a specification of the functionality that is required for a given application. That specification typically specifies semantics, access control rules, and the format and size of the data which may be stored. One usage may depend on another. For example, the SIP usage depends on a Certificate Store usage (not shown in the diagram) to obtain the certificates required to authenticate messages. Because certificates are stored in standard X.509 form, there is no reason for each usage to specify this service independently.
The Routing Layer provides a generic message routing service for the overlay. Each peer is identified by and its location in the overlay determined by its Peer-ID that is assigned by the enrollment server when the user or peer first enrolls in the overlay. A component which is a client of the Routing Layer can perform two basic functions: Send a message to a given peer, described by Peer-Id or Resource-Id. Receive messages that other peers sent to this peer's PeerId. All Usages are clients of the Routing Layer and use Reload's services by sending and receiving messages from peers. For instance, when a usage wants to store data, it does so by sending STORE requests. Note that the Storage component and the Topology Plugin are themselves clients of the Routing Layer, because they need to send and receive messages from other peers. The Routing Layer provides a fairly generic interface that allows the topology plugin control the overlay and resource operations and messages. Since each DHT is defined and functions differently, we generically refer to the table of other peers that the DHT maintains and uses to route requests (neighbors) as a Routing Table. The Routing Layer component makes queries to the DHT's Routing Table to determine the next hop, then encodes and sends the message itself. Similarly, the DHT issues periodic update requests through the logic component to maintain and update its Routing Table.
One of the major functions of RELOAD is to allow peers to store data in the overlay and to retrieve data stored by other peers or by themselves. The Storage component is responsible for processing data storage and retrieval messages from other peers. For instance, the Storage component might receive a STORE request for a given resource from the Routing Layer. It would then store the data value(s) in its local data store and sends a response to the Routing Layer for delivery to the requesting peer. The node's Peer-ID determines the set of resources which it will be responsible for storing. However, the exact mapping between these is determined by the DHT algorithm used by the overlay, therefore the Storage component always the queries the topology plugin to determine where a particular resource should be stored.
RELOAD is explicitly designed to work with a variety of DHTs. In order to facilitate this, the DHT implementation is provided by a pluggable Topology Plugin so that each overlay can select an appropriate DHT that relies on the common RELOAD core code. The Topology Plugin is responsible for maintaining the DHT Routing Table, which is consulted by the Routing Layer before routing a message. When connections are made or broken, the Forwarding Layer notifies the Topology Plugin, which adjusts the routing table as appropriate. The Topology Plugin will also instruct the Forwarding Layer to form new connections as dictated by the requirements of the DHT Topology. As peers enter and leave, resources may be stored on different peers, so Topology Plugin also keeps track of which peers are responsible for which resources. As peers join and leave, the Topology Plugin issues resource migration requests as appropriate, in order to ensure that other peers have whatever resources they are now responsible for. Redundancy is used to protect against loss of information in the event of a peer failure and to protect against compromised or subversive peers.
The Forwarding Layer is responsible for getting a packet to the next peer, as determined by the Routing and Storage Layer. The Forwarding Layer establishes and maintains the network connections as required by the Topology Plugin. This layer is also responsible for setting up connections to other peers through NATs and firewalls using ICE, and it can elect to forward traffic using relays for NAT and firewall traversal. The Forwarding Layer sits on top of transport layer protocols which carry the actual traffic. This specification defines how to use DTLS, TLS, and HIP to carry RELOAD messages.
The SIP Usage of RELOAD allows SIP user agents to provide a peer-to-peer telephony service without the requirement for permanent proxy or registration servers. In such a network, the RELOAD overlay itself performs the registration and rendezvous functions ordinarily associated with such servers. The SIP Usage involves two basic functions: SIP UAs can use the RELOAD data storage functionality to store a mapping from their AOR to their Peer-Id in the overlay, and to retrieve the Peer-Id of other UAs. Once a SIP UA has identified the Peer-Id for an AOR it wishes to call, it can use the RELOAD message routing system to set up a direct connection which can be used to exchange SIP messages. For instance, Bob could register his Peer-Id, "1234", under his AOR, "sip:bob@dht.example.com". When Alice wants to call Bob, she queries the overlay for "sip:bob@dht.example.com" and gets back Peer-Id 1234. She then uses the overlay to establish a direct connection with Bob and can use that direct connection to perform a standard SIP INVITE.
RELOAD provides two security models, one based on certificates assigned by a central server and one based on a shared key known to all members of the overlay. These credentials can be leveraged to provide communications security for RELOAD messages. RELOAD provides communications security at three levels: Connections between peers are secured with TLS or DTLS. Each RELOAD message can be signed (this is only possible with the certificate model.) Stored objects can be signed by the storing peer (this is only possible with the certificate model.) These three levels of security work together to allow peers to verify the origin and correctness of data they receive from other peers, even in the face of malicious activity by other peers in the overlay. RELOAD also provides access control built on top of these communications security features. Because the node responsible for storing a piece of data can verify the identity of the storing node, it can determine whether a given operation is permitted or not.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. We use the terminology and definitions from the Concepts and Terminology for Peer to Peer SIP draft extensively in this document. Other terms used in this document are defined inline when used and are also defined below for reference. [TODO: BBL, revise these terms] The following important terms from the Concepts document are defined below for reference. A distributed hash table. A DHT is an abstract hash table service realized by storing the contents of the hash table across a set of peers. A DHT algorithm defines the rules for determining which peers in a DHT store a particular piece of data and for determining a topology of interconnections amongst peers in order to find a piece of data. A specific hash table and the collection of peers that are collaborating to provide read and write access to it. There can be any number of DHT instances running in an IP network at a time, and each operates in isolation of the others. Another name for a DHT instance. A string that identifies a unique P2P network. P2P network names are DNS names - for example, "example.org". Lookup of such a name in DNS returns services associated with the DHT, such as enrollment servers, bootstrap peers, or gateways (for example, a SIP gateway between a traditional SIP and a P2P SIP network called "example.com"). A value that identifies some resources and which is used as a key for storing and retrieving the resource. Often this is not human friendly/readable. One way to generate a Resource-ID is by applying a mapping function to some other unique name (e.g., user name or service name) for the resource. The Resource-ID is used by the distributed database algorithm to determine the peer or peers that are responsible for storing the data for the overlay. In structured P2P networks, resource-IDs are generally fixed length and are formed by hashing the resource identifier. In unstructured networks, resource identifiers may be used directly as resource-IDs and may have variable length. A host that is participating in the DHT. By virtue of its participation it can store data and is responsible for some portion of the overlay. A 128-bit value that uniquely identifies a peer. Peer-IDs 0 and 2^128 - 1 are reserved and are invalid Peer-IDs. A value of zero is not used in the wire protocol but can be used to indicate an invalid peer in implementations and APIs. The Peer-ID of 2^N-1 is used on the wire protocol as a wildcard. An object associated with a string identifier. In unstructured P2P networks, the identifier is used directly as a Resource-Id. In structured P2P networks the identifier can be mapped into a Resource-ID by using the string as the input to hash function. A SIP resource, for example, is often identified by its AOR. A human being. > We also introduce the following important new terms. The set of peers to which a peer is directly connected. This includes peers with which CONNECT handshakes have been done but which have not sent any UPDATEs. The set of peers which a peer can use to route DHT messages. In general, these peers will all be on the connection table but not vice versa, because some peers will have CONNECTed but not sent updates. Peers may send messages directly to peers which are on the connection table but may only route messages to other peers through peers which are on the routing table. The generic term for an identifier in the hash space of the DHT. Examples of Hashed-IDs include Resource-IDs and Peer-IDs. This only applies to structured overlays. An Unhashed-ID is a string used as an input to a hash function, the result of which is a Hashed-ID. This only applies to structured overlays. A usage is an application that wishes to use the DHT for some purpose. Each application wishing to use the DHT defines a set of data kinds that it wishes to use. The SIP usage defines the location, certificate, STUN server and TURN server data kinds. A list of IDs through which a message is to be routed. A single Peer-ID is a trivial form of destination list.
The most basic function of RELOAD is as a generic overlay network. Nodes need to be able to join the overlay, form connections to other nodes, and route messages through the overlay to nodes to which they are not directly connected. This section provides an overview of the mechanisms that perform these functions.
Every node in the RELOAD overlay is identified by one or more Peer-IDs. The Peer-ID is used for three major purposes: To address the node itself. To determine its position in the overlay topology. To determine the set of resources for which the node is responsible. RELOAD supports two Peer-ID assignment models: certificate-based and shared-key. In the certificate based model, Peer-IDs are centrally assigned by an enrollment server which also issues the nodes with a PKI certificate attesting to its ownership of its assigned Peer-ID. This certificate can be used to authenticate connections to and from the node as well as to sign messages from the node. In the shared-key model, all the nodes in the overlay share a single static key which is used for admission control. Nodes choose their own Peer-IDs and there is no cryptographic mechanism from distinguishing one node from another. This model is only suitable for use in closed environments where nodes are mutually trusted.
The certificate-based security model revolves around the enrollment process allocating a unique name to the user and issuing a certificate for a public/private key pair for the user. All peers in a particular DHT instance can verify these certificates. A given peer acts on behalf of a user, and that user is responsible for its operation. The certificate serves two purposes: It entitles the user to store data at specific locations in the DHT Instance. Each kind defines the specific rules for determining which certificates can access each resource-ID/kind-id pair. For instance, some kinds might allow anyone to write at a given location, whereas others might restrict writes to the owner of a single certificate. It entitles the user to operate a peer that has a Peer-ID found in the certificate. When the peer forms a connection to another peer, it can use this certificate so that a client connecting to it knows it is connected to the correct server. In addition, the peer can sign messages, thus providing integrity and authentication for messages which are sent from the peer. When a user enrolls, or enrolls a device with no keying material, the user is given a certificate. This certificate contains information that identifies the user and the device they are using. If a user has more than one device, typically they would get one certificate for each device. This allows each device to act as a separate peer. The contents of the certificate include: A public key provided by the user. Zero or more user names that the DHT Instance is allowing this user to use. For example, "alice@example.org". Typically a certificate will have one name. In the SIP usage, this name corresponds to the AOR. Zero or more Peer-IDs. Typically there will be one Peer-ID. Each device will use a different Peer-ID, even if two devices belong to the same user. Peer-IDs should be chosen randomly by the enrollment server. A serial number that is unique to this certificate across all the certificates issued for this DHT instance. An expiration time for the certificate. At some point before the certificate expires, the user will need to get a new certificate from the enrollment server. Note that because Peer-IDs are chosen randomly, they will be randomly distributed with respect to the user name. This has the result that any given peer is highly unlikely to be responsible for storing data corresponding to its own user, which promotes high availability.
RELOAD also defines a shared-key security model which can be used in closed networks where all peers are trusted. In this model, the peers all share a single key which is used to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. If shared-key security mode is in use, a shared-key capable cipher suite such as TLS-PSK or TLS-SRP MUST be used. This is useful for admission control, but is completely unsafe in any setting where peers are not mutually trusted, since it allows any peer to impersonate any other peer.
RELOAD defines a single protocol that is used both as the peer protocol and client protocol for the overlay. This simplifies implementation, particularly for devices that may act in either role, and allows clients to inject messages directly into the overlay. TODO: this will have been covered in intro or prev section? We use the term peer to identify a node in the overlay routes messages other than those to which it is directly connected. Peers typically also have storage responsibilities although some overlays may also assign storage responsibilities to non-routing nodes. We use clients to refer to nodes that have no routing responsibilities and typically connect only to a single peer for access to the resources in the overlay. When text refers to either peers or clients, we will simply refer to such a device as a node.
Each peer in the overlay is provisioned with a certificate that provides its Node-ID, joins the overlay, and assumes routing responsibility for its portion of the overlay. However, there are many reasons why a capable node may not wish to serve as a full peer . Perhaps two of the most important are: The node does not have appropriate network connectivity---typically because it is behind an overly restrictive NAT. The node may not have sufficient resources, such as computing power, storage space, or battery power. The overlay algorithm may dictate specific requirements for peer selection. These may include participation in the overlay to determine trustworthiness or simply to control the number of peers in the overlay to reduce overly-long routing paths. While there are many more reasons, the ultimate criteria for an eligible peer is determined by the overlay algorithm and specific deployment. RELOAD's support for peer-capable clients allows nodes that are not participating in the overlay as peers to utilize the same implementation and to benefit from the same security mechanisms as the peers. Under this scenario a client uses its Node-ID to identify itself and its requests in the same manner as a peer. There are two routing options for such a client: Establish a connection to the peer responsibile for the client's Node-ID in the overlay. Then requests may be sent from/to the client using its Node-ID in the same manner as if it were a peer, because the responsible peer in the overlay will handle the final step of routing to the client. Establish a connection with an arbitrary peer in the overlay (perhaps based on network proximity or an inability to establish a direct connection with the responsible peer). In this case, the client will rely on RELOAD's Via List feature to ensure reachability. The client can initiate requests, and any node in the overlay that knows the Via List to its current location can reach it, but it is not arbitrarily reachable directly using only the client's Node-ID. (Note that it may be possible to extend the protoocl by including a usage that would allow the client to store a resource at its Node-ID in the overlay redirecting to its current Via List.) In all of these scenarios, the client speaks the same protocol as the peers, knows how to calculate Resource-IDs, and signs its requests in the same manner as peers. While a client does not necessarily require a full implementation of the overlay algorithm, calculating the Resource-ID requires an implementation of the appropriate algorithm for the overlay.
In order to exchange RELOAD messages with a peer, a client must meet a minimum level of functionality. Such a client must: Implement RELOAD's connection-management connections that are used to establish the connection with the peer. Implement RELOAD's data storage and retrieval methods (with client functionality). Be able to calculate Resource-IDs used by the overlay. Possess security credentials required by the overlay it is implementing. Such a client will be participating in the overlay as described in the previous section, but be unable to be promoted to a peer. RELOAD does not support a separate protocol for clients that do not meet these functionality requirements. Any such extension would either entail compromises on the features of RELOAD or require an entirely new protocol to reimplement the core features of RELOAD. Furthermore, for P2PSIP and many other applications, a native application-level protocol already exists that is sufficient for such a client, as described in the next section.
SIP defines an extensive protocol for registration and security between a client and its registrar/proxy server(s). Any SIP device can act as a client of a RELOAD-based P2PSIP overlay if it contacts a peer that implements the server-side functionality required by the SIP protocol. TODO Such an overlay would also require a security scheme that allows such a peer to authenticate a registration of resources for such a client (or just require the proxy to have its clients' keys).
[TODO: This section requires an understanding of ICE to make any sense] In order to provide efficient routing, a peer needs to maintain a set of direct connections to other peers in the DHT Instance. Because of the presence of NATs, these connections often cannot be formed directly. Instead, we use the CONNECT request to establish a connection. Say that peer A wishes to form a direct connection to peer B. It gathers ICE candidates and packages them up in a CONNECT request which it sends to B through usual DHT routing procedures. B does its own candidate gathering and sends back a response with its candidates. A and B then do ICE connectivity checks on the candidate pairs. The result is a connection between A and B. At this point, A and B can add each other to their routing tables and send messages directly between themselves without going through other DHT peers. There is one special case in which CONNECT cannot be used: when a peer is joining the overlay and is not connected to any peers. In order to support this case, some small number of "bootstrap nodes" need to be publicly accessible so that new peers can directly connect to them. Section [XREF] contains more detail on this. In general, a peer needs to maintain connections to all of the peers near it in the DHT Instance and to enough other peers to have efficient routing (the details depend on the specific DHT). If a peer cannot form a connection to some other peer, this isn't necessarily a disaster; DHTs can route correctly even without fully connected links. However, a peer should try to maintain the specified link set and if it detects that it has fewer direct connections, should form more as required. This also implies that peers need to periodically verify that the connected peers are still alive and if not try to reform the connection or form an alternate one.
This section will discuss the requirements RELOAD's routing capabilities must meet, then describe the routing features in the protocol, and provide a brief overview of how they are used. The section will conclude by discussing some alternative designs and the tradeoffs that would be necessary to support them. RELOAD's routing capabilities must meet the following requirements: RELOAD must support establishing and using connections between nodes separated by one or more NATs, including locating peers behind NATs for those overlays allowing/requiring it. RELOAD must support requests from and to clients that do not participate in overlay routing. RELOAD must support clients that become peers at a later point as determined by the overlay algorithm and deployment. RELOAD's routing algorithms must not require significant state to be stored on intermediate peers. To meet these requirements, RELOAD's routing relies on two basic mechanisms: The forwarding header used by all RELOAD messages contains both a Via List (built hop-by-hop as the message is routed through the overlay) and a Destination List (providing source-routing capabilities for requests and return-path routing for responses). The ROUTE_QUERY method allows a node to query a peer for the next hop it will use to route a message. This method is useful for diagnostics and for iterative routing. The basic routing mechanism used by RELOAD is symmetric recursive. We will first describe symmetric routing and then discuss its advantages in terms of the requirements discussed above. Symmetric recursive routing requires a message follow the path through the overlay to the destination without returning to the originating node: each peer forwards the message closer to its destination. The return path of the response is then the same path followed in reverse. For example, a message following a route from A to Z through B and X:
Note that the preceding Figure does not indicate whether A is a client or peer---A forwards its request to B and the response is returned to A in the same manner regardless of A's role in the overlay. This Figure shows use of full via-lists by intermediate peers B and X. However, if B and X are willing to store state, then they may elect to truncate the lists, save that information internally, and return the response message along the path from which it was received when the response is received. This option requires greater state on intermediate peers but saves a small amount of bandwidth and reduces the need for modifying the message enroute. Selection of this mode of operation is a choice for the individual peer---the techniques are mutually interoperable even on a single message.
For debugging purposes, a Route Log attribute is available that stores information about each peer as the message is forwarded. RELOAD also supports a basic iterative routing mode (where the intermediate peers merely return a response indicating the next hop, but do not actually forward the message to that next hop themselves). Iterative routing is implemented using the ROUTE_QUERY method, which requests this behavior. Note that iterative routing is selected only by the initiating peer. RELOAD does not support an intermediate peer returning a response that it will not recursively route the request---the willingness to perform that operation is implicit in its role as a peer in the overlay.
Significant discussion has been focused on the selection of a routing algorithm for P2PSIP. This section discusses the motivations for selection of symmetric recursive routing for RELOAD and describes the extensions that would be required to support additional routing algorithms.
Iterative routing has a number of advantages. It is easier to debug, consumes fewer resources on intermediate peers, and allows the querying peer to identify and route around misbehaving peers. However, in the presence of NATs iterative routing is intolerably expensive because a new connection (using ICE) must be established for each hop. Iterative routing is supported through the ROUTE_QUERY mechanism and is primarily intended for debugging. It is also the most reliable technique in the presence of compromised peers or network transitivity because the querying peer can evaluate the routing decisions made by the peers at each hop and consider alternatives [REF].
An alternative to the symmetric recursive routing method used by RELOAD is forward-only routing, where the response is routed to the requester as if it is a new message initiating by the responder (in the previous example, Z sends the response to A as if it was sending a request). Forward-only routing requires no state in either the message or intermediate peers. The drawback of forward-only routing is that it does not work when the overlay is unstable. For example, if A is in the process of joining the overlay and is sending a JOIN request to Z, it is not yet reachable via forward routing. Even if it is established in the overlay, if network failures produce temporary instablity, A may not be reachable (and may be trying to stabilize its network connectivity via CONNECT messages). An extension to RELOAD that supports forward-only routing but relies on symmetric responses as a fallback would be possible, but due to the complexities of determining when to use forward-only and when to fallback to symmetric, we have chosen not to include it as an option at this point.
A highly desireable routing option is to return the response directly to the querying node. In the previous example, if A encodes its IP address in the request, then Z can simply deliver the response directly to A. In the absence of NATs or other connectivity issues, this is the optimal routing technique. The challenge of implementing direct response is implementing it in the presence of NATs. There are a number of complexities that must be addressed. In this discussion, we will continue our assumption that A issued the request and Z is generating the response. The IP address listed by A may be unreachable, either due to NAT or firewall rules. Therefore, a direct response technique must fallback to symmetric response. The hop-by-hop ACKs used by RELOAD allow Z to determine when A has received the message (and the SSL negotiation will provide earlier confirmation that A is reachable), but this fallback requires a timeout that will increase the response latency whenever A is not reachable from Z. Whenever A is behind a NAT it will have multiple candidate IP addresses, each of which must be advertised to ensure connectivity, therefore Z will need to attempt multiple connections to deliver the response. One (or all) of A's candidate addresses may route from Z to a different device on the Internet. In the worst case these nodes may actually be running RELOAD on the same port. Therefore, establishing a secure connection to authenticate A before delivering the response is absolutely necessary. This step diminishes the efficiency of direct response because TODO roundtrips are required before the message can be delivered. If A is behind a NAT and does not have a connection already established with Z, there are only two ways the direct response will work. The first is that A and Z are both behind the same NAT, in which case the NAT is not involved. In the more common case, when Z is outside A's NAT, the response will only be received if A's NAT implements endpoint-independent filtering. Because this is not the recommended filtering mode for NATs, this ability is likely to become less common over time. An extension to RELOAD that supports direct response routing but relies on symmetric responses as a fallback would be possible, but due to the complexities of determining when to use forward-only and when to fallback to symmetric, and the reduced performance for responses to peers behind restrictive NATs, we have chosen not to include it as an option at this point.
SEP has proposed implementing a form of direct response by having A identify a peer, Q, that will be directly reachable by any other peer. A uses CONNECT to establish a connection with Q and advertises Q's IP address in the request sent to Z. Z sends the response to Q, which relays it to A. This then reduces the latency to two hops, plus Z negotiating a secure connection to Q. This technique relies on the relative population of nodes such as A that require relay peers and peers such as Q that are capable of serving as a relay peer. It also requires nodes to be able to identify which category they are in. An extension to RELOAD that supports relay peers is possible, but due to the complexities of implementing such an alternative, we have not added such a feature to RELOAD at this point.
A common concern about symmetric recursive routing has been that one or more peers along the request path may fail before the response is received. The significance of this problem essentially depends on the response latency of the overlay---an overlay that produces slow responses will be vulnerable to churn, whereas responses that are delivered very quickly are vulnerable only to failures that occur over that small interval. The other aspect of this issue is whether the request itself can be successfully delivered. Assuming typical connection maintenance intervals, the time period between the last maintenance and the request being sent will be orders of magnitude greater than the delay between the request being forwarded and the response being received. Therefore, if the path was stable enough to be available to route the request, it is almost certainly going to remain available to route the response [REF: havethisneedtogetit]. An overlay that is unstable enough to suffer this type of failure frequently is unlikely to be able to support reliable functionality regardless of the routing mechanism. Finally, because RELOAD retries the end-to-end request, that retry will address the issues of churn that remain.
[TODO: UNKNOWN]
When a new peer wishes to join the DHT Instance, it must have a Peer-ID that it is allowed to use. It uses one of the Peer-IDs in the certificate it received from the enrollment server. The main steps in joining the DHT Instance are: Forming connections to some other peers. Acquiring the data values this peer is responsible for storing. Informing the other peers which were previously responsible for that data that this peer has taken over responsibility. The first thing the peer needs to do is form a connection to some "bootstrap node". Because this is the first connection the peer makes, these nodes "bootstrap nodes" MUST have public IP addresses and therefore can be connected to directly. Once a peer has connected to one or more bootstrap nodes, it can form connections in the usual way by routing CONNECT messages through the overlay to other nodes. Once a peer has connected to the overlay for the first time, it can cache the set of nodes it has connected to with public IP addresses for use as future bootstrap nodes. Once the peer has connected to a bootstrap node, it then can use overlay routing to contacts the peer which would have formerly been responsible for the peer's Peer-ID (since that is where in the DHT Instance the peer will be joining), the Admitting Peer (AP). It copies the other peer's state, including the data values it is now responsible for and the identities of the peers with which the other peer has direct connections. The details of this operation depend mostly on the DHT involved, but a typical case would be: JP sends a JOIN request to AP announcing its intention to join. AP sends a JOIN response. AP does a sequence of STOREs to JP to give it the data it will need. AP does UPDATEs to JP and to other peers to tell it about its own routing table. At this point, both JP and AP consider JP responsible for some section of the DHT Instance. JP makes its own connections to the appropriate peers in the DHT Instance. After this process is completed, JP is a full member of the DHT Instance and can process STORE/FETCH requests.
[TODO: SAB]
Previous sections addesssed how RELOAD works once a node has connected. This section provides an overview of how users get connected to the overlay for the first time. RELOAD is designed so that users can start with the name of the overlay they wish to join and perhaps a username and password, and leverage that into having a working peer with minimal user intervention. This helps avoid the problems that have been experienced with conventional SIP clients where users are required to manually configure a large number of settings.
In the first phase of the process, the user starts out with the name of the overlay and uses this to download an initial set of overlay configuration parameters. The user does a DNS SRV lookup on the overlay name to get the address of a configuration server. They can then connect to this server with HTTPS to download a configuration document which contains the basic overlay configuration parameters as well as a set of bootstrap nodes which can be used to join the overlay (see [XREF]).
If the overlay is using certificate-based access control, then a user needs to acquire a certificate before joining the overlay. In that case, the configuration document will contain the address of an enrollment server which can be used to obtain such a certificate. The enrollment server may (and probably will) require some sort of username and password before issuing the certificate.
[TODO: HGS; this needs bridge text to explain what application support is.]
[TODO: HGS; hopefully the intro to the enclosing section will explain what a Data Storage Layer is.] The Data Storage Layer provides operations to STORE, FETCH, and REMOVE data. Each location in the DHT Instance is referenced by a single integer Resource-ID. However, each location may contain data elements corresponding to multiple kinds (e.g., certificate, SIP registration). Similarly, there may be multiple elements of a given kind.
Each kind is identified by a kind-id, which is a code point assigned by IANA. Note that a kind may be employed by multiple usages and new usages are encouraged to use previously defined kinds where possible. As part of the kind definition, protocol designers may define constraints, such as limits on size, on the values which may be stored. For many kinds, the set may be restricted to a single value; some sets may be allowed to contain multiple identical items while others may only have unique items. We define the following data models in this document, though other usages can define their own structures: There can be at most one item in the set and any value overwrites the previous item. Many values can be stored and addressed by index. The values stored are indexed by a key. Often this key is one of the values from the certificate of the peer sending the STORE request. [TODO: HGS; I glued two sxns together here. This needs bridge text.] By itself, the distributed storage layer just provides infrastructure on which applications are built. In order to do anything useful, a usage must be defined. Each Usage needs to specify several things: Register kind-id code points for any kinds that the Usage defines. Define the data structure for each of the kinds. Define access control rules for each kinds. Provide a size limit for each kinds. Define how the Unhashed-ID is formed that is hashed to form the Resource-ID where each kind is stored. Describe how values will be merged after a network partition. Unless otherwise specified, the default merging rule is to act as if all the values that need to be merged were stored and that the order they were stored in corresponds to the stored time values associated with (and carried in) their values. Because the stored time values are those associated with the peer which did the writing, clock skew is generally not an issue. If if two nodes are on different partitions, clocks, this can create merge conflicts. However because RELOAD deliberately segregates storage so that data from different users and peers is stored in different locations, and a single peer will typically only be in a single network partition, this case will generally not arise. The kinds defined by a usage may also be applied to other usages. However, a need for different parameters, such as different size limits, would imply the need to create a new kind. [TODO: HGS; I glued two sxns together here. This needs bridge text.]
When a peer uses a STORE request to place data at a particular location X, it must sign with the private key that corresponds to a certificate that is suitable for storing at location X. Each data kind in a usage defines the exact rules for determining what certificate is appropriate. The most natural rule is that a certificate with user name X "owns" data located at Hash(X) (X is the Unhashed-ID and Hash(X) is the Hashed-ID) and only he can write there. This rules is used for all the kinds defined in this specification. Thus, only a user with a certificate for "alice@example.org" could write to that location in the DHT. However, other usages can define any rules they choose, including publicly writable values. The digital signature over the data serves two purposes. First, it allows the peer responsible for storing the data to verify that this STORE is authorized. Second, it provides integrity for the data. The signature is saved along with the data value (or values) so that any reader can verify the integrity of the data. Of course, the responsible peer can "lose" the value but it cannot undetectably modify it.
[TODO: UNKNOWN]
Replication in P2P overlays can be used to provide: if the responsible peer crashes and/or if the storing peer leaves the overlay to guard against DoS attacks by the responsible peer or routing attacks to that responsible peer to balance the load of queries for popular resources. A variety of schemes are used in P2P overlays to achieve some of these goals. Common techniques include replicating on neighbors of the responsible peer, randomly locating replicas around the overlay, or replicating along the path to the responsible peer. The core RELOAD specification does not specify a particular replication strategy. Instead, the first level of replication strategies are determined by the overlay algorithm, which can base the replication strategy on the its particular topology. For example, Chord places replicas on successor peers, which will take over responsibility should the responsible peer fail. If additional replication is needed, for example if data persistence is particularly important for a particular usage, then that usage may specify additional replication, such as implementing random replications by inserting a salt into the keyword used to store a resource. Such replication strategies can be added independent of the underlying algorithm, and their usage can be determined based on the needs of the particular usage.
There is no requirement that a RELOAD usage must use RELOAD's primitives for establishing its own communication if it already posesses its own means of establishing connections. For example, if a P2PSIP node registers a simple SIP URI in an overlay, such as alice@example.com, then conventional SIP resolution is applied to establish a dialog. For more common situations, where the overlay itself is used to establish a connection rather than an external authority such as DNS, RELOAD provides connectivity to applications using the same CONNECT method as is used for the overlay maintenance. For example, if a P2PSIP node wishes to establish a SIP dialog with another P2PSIP node, it will use CONNECT to establish a direct connection with the other node. This new connection is separate from the peer protocol connection, it is a dedicated UDP or TCP flow used only for the SIP dialog. Each usage specifies which types of connections can be initiated using CONNECT. Previous versions of RELOAD specified a TUNNEL method by which a usage could specify how to route application-specific messages across the overlay without establishing a new connection. This version withdraws that method because it is essentially an optimization that adds additional complexity, particularly in specifying how an application such as SIP will make use of the feature, without adding additional functionality. It may be reintroduced in the future.
The SIP Usage of RELOAD allows SIP user agents to provide a peer-to-peer telephony service without the requirement for permanent proxy or registration servers. In such a network, the RELOAD overlay itself performs the registration and rendezvous functions ordinarily associated with such servers. The basic function of the SIP usage is to allow Alice to start with a SIP URI (e.g., "bob@dht.example.com") and end up with a connection which Alice's SIP UA can use to pass SIP messages back and forth to Bob's SIP UA. The way this works is as follows: Bob, operating Peer-ID 1234, stores a mapping from his URI to his Peer-ID in the overlay. I.e., "sip:bob@dht.example.com -> 1234". Alice, operating Peer-ID 5678, decides to call Bob. She looks up "sip:bob@dht.example.com" in the overlay and retrieves "1234". Alice uses the overlay to route a CONNECT message to Bob's peer. Bob responds with his own CONNECT and they set up a direct connection, as shown below.
CONNECT -> CONNECT -> CONNECT -> <- CONNECT <- CONNECT <- CONNECT <- CONNECT <------------------- ICE Checks -----------------> INVITE ------------------------------------------> <---------------------------------------------- OK ACK ---------------------------------------------> ]]>
It's important to note that RELOAD's only role here is to set up the direct connection between Alice and Bob. As soon as the ICE checks complete and that connection is established, then ordinary SIP is used. In particular, the establishment of the media channel for the phone call happens via the usual SIP mechanisms, and RELOAD is not involved. Media never goes over the overlay. As well as allowing mappings from AORs to Peer-IDs, the SIP Usage also allows mappings from AORs to other AORs. For instance, if Bob wanted his phone calls temporarily forwarded to Charlie, he could store the mapping "sip:bob@dht.example.com -> sip:charlie@dht.example.com". When Alice wants to call Bob, she retrieves this mapping and can then fetch Charlie's AOR to retrieve his Peer-ID.
This section describes the basic protocols used create, maintain, and use the RELOAD overlay network. We start by describing how messages are transmitted, received, and routed in an existing overlay, then describe the message structure, and then finally describe the messages used to join and maintain the overlay.
Regardless of which DHT algorithm is used, a RELOAD overlay is a partly connected (incomplete) graph of nodes, each identified by Peer-ID. Each node maintains a set of connections to some other set of nodes in the overlay. If a node is directly connected to the destination of a message, it can send it directly. However, in general, any two nodes will probably not be directly connected; when node A wants to send a message to node B, the message must traverse other nodes in the graph, with the precise set of intermediate nodes traversed depending on the DHT algorithm. RELOAD intentionally separates the generic mechanisms for routing messages from the precise DHT topology. The topology plugin (see [XREF]) should be thought of as providing a routing table. When a node wishes to transmit a message to a given Peer-ID to which it is not connected, it consults the routing table which tells it which of its existing connections to forward the message down. However, the procedures for sending, receiving, and forwarding the messages are the same regardless of the topology and contents of the routing table. RELOAD also incorporates a loose source routing feature using DESTINATION LISTS. When a node transmits a message it can provide a set of Peer-IDs which it wishes the message to be routed through. Each intermediate node examines the first entry on the destination list and routes the message to that node. When that node is reached, it removes itself from the destination list and routes based on the next entry. This repeats until the message arrives at its final destination. This makes it possible to address a peer which is potentially behind a NAT or a firewall in such a way that it cannot be connected to directly under any circumstances
In order to originate a message to a given Peer-ID or resource-id, a peer must first construct an appropriate destination list. The most common such destination list is a single entry containing the peer/resource-id. This simply uses the normal DHT routing mechanisms to forward the message to that destination. The peer can also construct a more complicated destination list to allow source routing. Once the message is constructed, the node sends it down the appropriate connection to some adjacent peer. If the first entry on the destination list is directly connected, then the message will be routed down that connection. Otherwise, the topology plugin will be consulted to determine the appropriate next hop. [[TODO: Salman has suggested the originator doing parallel requests/responses. This is an open issue.] Because messages may be lost in transit through the overlay, RELOAD incorporates an end-to-end reliability mechanism. When an originating node transmits a request it sets a 3 second timer. If a response has not been received when the timer fires, the request is retransmitted with the same transaction identifier. The request may be retransmitted up to 4 times (for a total of 5 messages). After the timer for the fifth transmission fires, the message SHALL be considered to have failed. Note that this retransmission procedure is not followed by intermediate nodes. They follow the hop-by-hop reliability procedure described in [XREF].
When a peer receives a message, it first examines the overlay, version, and other header fields to determine whether the message is one it can process. If any of these are incorrect (e.g., the message is for an overlay in which the peer does not participate) it is an error. The peer SHOULD generate an appropriate error but if local policy can override this in which case the messages is silently dropped. Once the peer has determined that the message is correctly formatted, it examines the first entry on the destination list. There are three possible cases here: The first entry on the destination list is an id for which the peer is responsible. The first entry on the destination list is a an id for which another peer is responsible. The first entry on the destination list is a private id which is being used for destination list compression. These cases are handled as discussed below.
If the first entry on the destination list is a Hashed-ID for which the peer is responsible, the peer strips the entry off the destination list. If there are remaining entries on the destination list, the peer then re-examines the destination list to determine which case now applies. If the destination list is now empty, then the message was destined for this peer and it MUST pass it to the next layer up.
If neither of the other two cases applies, then the peer MUST forward the message towards the first entry on the destination list. This means that it MUST select one of the peers to which it is connected and which which is closer to the first entry than to itself and send the message to that peer. If the first entry on the destination list is in the peer's connection table, then it SHOULD forward the message to that peer directly. Otherwise, it MUST consult the route table. RELOAD messages contain a via list which lists each peer that the message has traversed. When a peer forwards a message it MUST update the via list. The natural way to update the via list is simply to add the Peer-ID of the peer from which the message was received to the end of the list. However, peers may use any algorithm of their choice provided that if the peer received a destination list constructed by reversing the via list it would be able to route the outgoing message correctly, enabling symmetric routing. For instance, if node D receives a message from node C with via list (A, B), the simple approach is simply to forward to the next node (E) with via list (A, B, C). Now, if E wants to respond to the message, it reverses the via list to produce the destination list, resulting in (D, C, B, A). When D forwards the response to C, the destination list will contain (C, B, A). However, node D could also list compression and send E the via list (X). E would then use the destination list (D, X). When D processes this destination list, it MUST detect that X is a compressed entry, recover the via list (A, B, C), and reverse that to produce the correct destination list (C, B, A) before sending it to C. Note that if a peer is using list compression and then exits the overlay, the message cannot be forwarded and will be dropped. The ordinary timeout and retransmission mechanisms provide stability over this type of failure.
If the first entry on the destination list is a private id, the peer replaces that entry with the stored local value that it indexes and then re-examines the destination list to determine which case now applies.
When a peer sends a response to a request, it SHOULD construct the destination list by reversing the order of the entries on the via list. This has the result that the response traverses (at least) the same peers as the request traversed, except in reverse order (symmetric routing).
RELOAD is a message-oriented request/response protocol. The messages are encoded using binary fields. All integers are represented in network byte order. The general philosophy behind the design was to use Type, Length, Value fields to allow for extensibility. However, for the parts of a structure that were required in all messages, we just define these in a fixed position as adding a type and length for them is unnecessary and would simply increase bandwidth and introduces new potential for interoperability issues. Each message has three parts, concatenated as shown below:
The contents of these parts are as follows: Each message has a generic header which is used to forward the message between peers and to its final destination. This header is the only information that an intermediate peer (i.e., one that is not the target of a message) needs to examine. The message being delivered between the peers. From the perspective of the forwarding layer, the contents is opaque, however, it is interpreted by the higher layers. A digital signature over the message contents and parts of the header of the message. Note that this signature can be computed without parsing the message contents. The following sections describe the format of each part of the message.
Most of the structures defined in this document (with the exception of the forwarding header defined in the next section) are defined using a C-like syntax based on the presentation language used to define TLS. Advantages of this style include: It is easy to write and familiar enough looking that most readers can grasp it quickly. The ability to define nested structures allows a separation between high-level and low level message structures. It has a straightforward wire encoding that allows quick implementation, but the structures can be comprehended without knowing the encoding. This presentation is to some extent a placeholder. We consider it an open question what the final protocol definition method and encodings use. We expect this to be a question for the WG to decide. Several idiosyncracies of this language are worth noting. All lengths are denoted in bytes, not objects. Variable length values are denoted like arrays with angle brackets. "select" is used to indicate variant objects. For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes but only up to 127 values of two bytes (16 bits) each..
The following definitions are used throughout RELOAD and so are defined here. They also provide a convenient introduction to how to read the presentation language. An enum represents an enumerated type. The values associated with each possibility are represented in parentheses and the maximum value is represented as a nameless value, for purposes of describing the width of the containing integral type. For instance, Boolean represents a true or false:
A boolean value is either a 1 or a 0 and is represented as a single byte on the wire. The PeerId, shown below, represents a single Peer-ID.
A PeerId is a fixed-length 128-bit structure represented as a series of bytes, most significant byte first. Note: the use of "typedef" here is an extension to the TLS language, but its meaning should be relatively obvious. A ResourceId, shown below, represents a single resource-id.
; ]]>
Like a PeerId, a resource-id is an opaque string of bytes, but unlike Peer-IDs, resource ids are variable length, up to 255 bytes (2048 bits) in length. On the wire, each ResourceId is preceded by a single length byte (allowing lengths up to 255). Thus, the 3-byte value "Foo" would be encoded as: 03 46 4f 4f. A more complicated example is IpAddressPort, which represents a network address and can be used to carry either an IPv6 or IPv4 address:
The first two fields in the structure are the same no matter what kind of address is being represented: the type of address (v4 or v6). the length of the rest of the structure. By having the type and the length appear at the beginning of the structure regardless of the kind of address being represented, an implementation which does not understand new address type X can still parse the IpAddressPort field and then discard it if it is not needed. The rest of the IpAddressPort structure is either an IPv4AddrPort or an IPv6AddrPort. Both of these simply consist of an address represented as an integer and a 16-bit port. As an example, here is the wire representation of the IPv4 address "192.0.2.1" with port "6100".
The layout of the forwarding header is shown below. We present this as a bit diagram because it is mostly fixed and to show the similarities with other packet headers.
The first four bytes identify this message as a RELOAD message. The message is easy to demultiplex from STUN messages by looking at the first bit. The Overlay field is the 32 bit checksum/hash of the overlay being used. The variable length string representing the overlay name is hashed with SHA-1 and the low order 32 bits are used. The purpose of this field is to allow nodes to participate in multiple overlays and to detect accidental misconfiguration. TTL (time-to-live) is an 8 bit field indicating the number of iterations, or hops, a message can experience before it is discarded. The TTL value MUST be decremented by one at every hop along the route the message traverses. If the TTL is 0, the message MUST NOT be propagated further and MUST be discarded. The initial value of the TTL should be TBD. FRAG is a 1 bit field used to specify if this message is a fragment.
LFRG is a 1 bit field used to specify whether this is the last fragment in a complete message.
[[Open Issue: How should the fragment offset and total length be encoded in the header? Right now we have 14 bits reserved with the intention that they be used for fragmenting, though additional bytes in the header might be needed for fragmentation.]] Version is a 7 bit field that indicates the version of the RELOAD protocol being used.
The message Length is the count in bytes of the size of the message, including the header. The Transaction ID is a unique 64 bit number that identifies this transaction and also serves as a salt to randomize the request and the response. Responses use the same Transaction ID as the request they correspond to. Transaction IDs are also used for fragment reassembly. The Destination List Length and the Via List Length contain the lengths of the route and via lists respectively, in the number of objects. [[Open Issue: How should we handle Peer-ID lengths? This basically assumes they're fixed length per DHT algorithm (but not fixed-length for RELOAD) so that you can unambiguously parse things. Should we have a length byte?]] The flags word contains control flags. There is one currently defined flag.
The ROUTE-LOG flag indicates that the route log should be included (see [XREF]) The Destination List contains a sequence of destinations which the message should pass through. The destination list is constructed by the message originator. The first element in the destination list is where the message goes next. The list shrinks as the message traverses each listed peer. Destinations are defined at the end of this section. The Via List contains the sequence of destinations through which the message has passed. The via list starts out empty and grows as the message traverses each peer. If a message was being sent thought the sequences of peers A,B,C,D, the message from A to B would have a empty via list and a route of list of B,C,D. The message from B to C would have a via list of A then route of C,D and so on. This means that when the route list is followed exactly, all that is needed to update these lists is to change their lengths. This avoids the need to change or move any of the other list entries. In other cases, some entries may need to be copied or moved. The destination list and via lists are sequences of Destination values:
This is a TLV structure with the following contents: The type of the DestinationData PDU. This may be one of "peer", "resource", or "compressed". The length of the destination_data. The destination value itself, which is an encoded DestinationData structure, depending on the value of "type". Note: This structure encodes a type, length, value. The length field specifies the length of the DestinationData values, which allows the addition of new DestinationTypes. This allows an implementation which does not understand a given DestinationType to skip over it. A DestinationData can be one of three types: A Peer-ID. A compressed list of Peer-IDs and/or resources. Because this value was compressed by one of the peers, it is only meaningful to that peer and cannot be decoded by other peers. Thus, it is represented as an opaque string. The resource id of the resource which is desired. This type MUST only appear in the final location of a destination list and MUST NOT appear in a via list. It is meaningless to try to route through a resource.
The route logging feature provides diagnostic information about the path taken by the request so far and in this manner it is similar in function to SIP's Via header field. If the ROUTE-LOG flag is set in the Flags word, at each hop peers MUST append a route log entry to the route log element in the header. The order of the route log entry elements in the message is determined by the order of the peers were traversed along the path. The first route log entry corresponds to the peer at the first hop along the path, and each subsequent entry corresponds to the peer at the next hop along the path. If the ROUTE-LOG flag is set in a request, the route log MUST be copied into the response and the ROUTE-LOG flag set so that the originator receives the ROUTE-LOG data. If the responder wishes to have a route log in the reverse direction, it MAY set the ROUTE-LOG flag in its response as well. Note, however, that this means that the response will grow on the return path, which may potentially mean that it gets dropped due to becoming too large for some intermediate hop. Thus, this option must be used with care. The route log is defined as follows:
; /* A string */ Transport transport; /* TCP or UDP */ PeerId id; uint32 uptime; IpAddressPortPort address; opaque certificate<0..2^16-1>; } RouteLogEntry; struct { RouteLogEntry entries<0..2^16-1>; } RouteLog; ]]>
The route log consists of an arbitrary number of RouteLogEntry values, each representing one node through which the message has passed. Each RouteLogEntry consists of the following values: A textual representation of the software version The transport type, currently either "tcp_tls" or "udp_dtls". The Peer-ID of the peer. The uptime of the peer in seconds. The address and port of the peer. The peer's certificate. Note that this may be omitted by setting the length to zero.
The second major part of a RELOAD message is the contents part, which is defined by MessageContents:
; } MessageContents; ]]>
The contents of this structure are as follows: This indicates the message that is being sent. The code space is broken up as follows. Reserved Requests and responses. These code points are always paired, with requests being odd and the corresponding response being the request code plus 1. Thus, PING_Q (the PING request) has value 1 and PING_A (the PING response) has value 2 Error A reserved 16-bit value. [TODO: Do we need this?] The message body itself, represented as a variable-length string of bytes. The bytes themselves are dependent on the code value. See the sections describing the various RELOAD methods (JOIN, UPDATE, CONNECT, STORE, FETCH, etc.) for the definitions of the payload contents. [TODO: We could represent this as a big select() with enums as well. That sort of removes layering but is clearer from a presentation language perspective. Comments?]
A peer processing a request returns its status in the message_code field of the header. If the request was a success, then the message code is the response code that matches the request (i.e., the next code up). The response payload is then as defined in the request/response descriptions. If the request failed, then the message code is set to 0xffff (error) and the payload MUST be an error_response PDU, as shown below. When the message code is 0xffff, the payload MUST be an ErrorResponse.
; /* String*/ opaque error_info<0..65000>; } ErrorResponse; ]]>
The contents of this structure are as follows: A numeric error code indicating the error that occurred. A free form text string indicating the reason for the response. The reason phrase SHOULD BE as indicated in the error code list below (e.g., "Moved Temporarily). Payload specific error information. This MUST be empty (zero length) except as specified below. The following error code values are defined. [[TODO: These are currently semi-aligned with SIP codes. that's probably bad and we need to fix.] The requesting peer SHOULD retry the request at the new address specified in the 302 response message. The requesting peer needs to sign and provide a certificate. [[TODO: The semantics here don't seem quite right.]] The requesting peer does not have permission to make this request. The resource or peer cannot be found or does not exist. A response to the request has not been received in a suitable amount of time. The requesting peer MAY resend the request at a later time. A request can't be completed because some precondition was incorrect. For instance, the wrong generation counter was provided A peer receiving the request is using a different overlay, DHT algorithm, or hash algorithm. [[Open Issue: What is the best error number and reason phrase to use?]] A peer receiving the request is unwilling to support the Routing mechanism specified in the Routing field of the message header. [[Open Issue: What is the best error number and reason phrase to use?]]
The third part of a RELOAD message is the signature, represented by a Signature structure. The Signature PDU is used to attach signatures to messages and or stored data elements. All signatures are formatted using this element. However, the input structure to the signature computation varies depending on the data element being signed.
; case signer_identity_certificate: opaque certificate<0..2^16-1>; /* This structure may be extended with new types */ } SignerIdentityValue; struct { SignerIdentityType identity_type; uint16 length; SignerIdentityValue identity[SignerIdentity.length]; } SignerIdentity; struct { SignatureAndHashAlgorithm algorithm; SignerIdentityType identity; opaque signature_value<0..2^16-1>; } Signature; ]]>
The signature construct contains the following values: The signature algorithm in use. The algorithm definitions are found in the IANA TLS SignatureAlgorithm Registry. The identity or certificate used to form the signature The value of the signature A number of possible identity formats are permitted. The current possibilities are: a Peer-ID, a user name, and a certificate. For signatures over messages the input to the signature is computed over: overlay + transaction_id + MessageContents + SignerIdentity Where overlay and transaction_id come from the forwarding header and + indicates concatenation. [[TODO: Check the inputs to this carefully.]] The input to signatures over data values is different, and is described in [XREF].
[TODO: UNKNOWN]
[TODO: UNKNOWN]
When specifying a new DHT, at least the following need to be described: Joining procedures, including the contents of the JOIN message. Stabilization procedures, including the contents of the UPDATE message, the frequency of topology probes and keepalives, and the mechanism used to detect when peers have disconnected. Exit procedures, including the contents of the LEAVE message. The hash algorithm used to go from a Unhashed-ID, such as a user name, to a Resource-ID. This also includes the length of the Resource-IDs and Peer-IDs The procedures that peers use to route messages. The replication strategy used to ensure data redundancy.
[TODO: UNKNOWN]
A new peer (but which already has credentials) uses the JOIN_Q message to join the DHT. The JOIN_Q is sent to the peer which previously was responsible for the resource-id corresponding to the Peer-ID which the new peer has. This notifies the responsible peer that the new peer is taking over some of the overlay and it needs to synchronize its state.
; } JoinQ; ]]>
The minimal JOIN_Q contains only the Peer-ID which the sending peer wishes to assume. DHTs MAY specify other data to appear in this request. If the request succeeds, the responding peer responds with a JOIN_A message, as defined below:
; } JoinQ; ]]>
If the request succeeds, the responding peer MUST follow up by executing the right sequence of STOREs and UPDATEs to transfer the appropriate section of the overlay space to the joining peer. In addition, DHTs MAY define data to appear in the response payload that provides additional info.
The LEAVE_Q message is used to indicate that a peer is exiting the overlay. The peer SHOULD send this message to each peer with which it is directly connected prior to exiting the overlay.
; } LeaveQ; ]]>
The default LEAVE_Q contains only the Peer-ID of the leaving peer. DHTs MAY other specify data to appear in this request. Upon receiving a LEAVE request, a peer MUST update its own routing and routing table, and send the appropriate STORE/UPDATE sequences to re-stabilize the overlay.
Update is the primary DHT-specific maintenance message. It is used by the sender to notify the recipient of the sender's view of the current state of the overlay and it is up to the recipient to take whatever actions are appropriate to deal with the state change. The contents of the UPDATE_Q message are completely DHT-specific. The UPDATE_A response is expected to be either success or an error.
The ROUTE_QUERY request allows the sender to ask a peer where they would route a message directed to a given destination. In other words, a ROUTE-QUERY for destination X requests the Peer-ID where the receiving peer would next route to get to X. A ROUTE-QUERY can also request that the receiving peer initiate an UPDATE request to transfer his routing table. One important use of the ROUTE-QUERY request is to support iterative routing. The way that this works is that the sender selects one of the peers in its neighbor table and sends it a ROUTE-QUERY message with the destination_object set to the Peer-ID/resource-id it wishes to route to. The neighbor responds with the next Peer-ID to send to. The sending peer then CONNECTs to that peer and repeats the ROUTE-QUERY. Eventually, the sender gets a response from a peer containing a Peer-ID that is the same as the responding peer, which means that the responding peer is the closest. At that point, the sender can send whatever request is needed directly to that peer. Note that this procedure only works well if all the peers are mutually directly reachable--either by all having public IP addresses or at least by all being behind the same NAT. Accordingly, peers MUST only use this method if permitted by the overlay configuration (see [XREF]).
A ROUTE_QUERY_Q message indicates the peer or resource that the requesting peer is interested in. It also contains a "send_update" option allowing the requesting peer to request a full copy of the other peer's routing table.
The contents of the ROUTE_QUERY_Q message are as follows: A single byte. This may be set to "true" to indicate that the requester wishes the responder to initiate an UPDATE request immediately. Otherwise, this value MUST be set to "false". The destination which the requester is interested in. This may be any valid destination object, including a Peer-ID, compressed ids, or resource-id
A response to a successful ROUTE_QUERY request is a ROUTE_QUERY_A message containing the address of the peer to which the responding peer would have routed the request message in recursive routing.
The contents of the ROUTE_QUERY_A are as follows: The peer to which the responding peer would route the message to in order to deliver it to the destination listed in the request. The address of the next peer. If the requester set the send_update flag, the responder SHOULD initiate an UPDATE immediately after sending the ROUTE_QUERY_A.
Each node maintains connections to a set of other nodes defined by the topology plugin. For instance, in the Chord topology described in [XREF], node would maintain connections to 16 nodes in its finger table and to 6 neighbors.
RELOAD can use multiple transports to send its messages. Because ICE is used to establish connections (see ), RELOAD nodes are able to detect which transports are offered by other nodes and establish connections between each other. Any transport protocol needs to be able to establish a secure, authenticated connection, and provide data origin authentication and message integrity for individual data elements. RELOAD currently supports two transport protocols: TLS [REF] over TCP DTLS over UDP Note that although UDP does not properly have "connections", DTLS both have handshake which establishes a stateful association a similar stateful construct and we simply refer to these as "connections" for the purposes of this document.
The P2PSIP Working Group has expressed interest in supporting a HIP-based transport. Such support would require specifying such details as: How to issue certificates which provided identities meaningful to the HIP base exchange. We anticipate that this would require a mapping between ORCHIDs and PeerIds. How to carry the HIP I1 and I2 messages. We anticipate that this would require defining a HIP Tunnel usage. How to carry RELOAD messages over HIP. We leave this work as a topic for another draft.
When RELOAD is carried over DTLS or another unreliable transport, it needs to be used with a reliability and flow control mechanism, which is provided on a hop-by-hop basis, matching the semantics if TCP were used. The basic principle is that each message, regardless of if it carries a request or responses, will get an ACK and be reliably retransmitted. The receiver's job is very simple, limited to just sending ACKs. All the complexity is at the sender side. This allows the sending implementation to trade off performance versus implementation complexity without affecting the wire protocol. In order to support unreliable transport, each message is wrapped in a very simple framing layer (FramedMessage) which is only used for each hop. This layer contains a sequence number which can then be used for ACKs.
The definition of FramedMessage is:
; case ack: uint24 ack_sequence; uint32 received; }; } FramedMessage; ]]>
The type field of the PDU is set to indicate whether the message is data or an acknowledgement. If the message is of type "data", then the remainder of the PDU is as follows: the sequence number the original message that is being transmitted. Each connection has it own sequence number. Initially the value is zero and it increments by exactly one for each message sent over that connection. When the receiver receive a message, it SHOULD immediately send an ACK message. The receiver MUST keep track of the 32 most recent sequence numbers received on this association in order to generate the appropriate ack. The contents of the ACK PDU are as follows: The sequence number of the message being acknowledged. A bitmask indicating whether or not each of the previous 32 packets has been received before the sequence number in ack_sequence. The high order bit represents the first packet in the sequence space. The received field bits in the ACK provide a very high degree of redundancy for the sender to figure out which packets the receiver received and can then estimate packet loss rates. If the sender also keeps track of the time at which recent sequence numbers were sent, the RTT can be estimated.
Because the receiver's role is limited to providing packet acknowledgements, a wide variety of congestion control algorithms can be implemented on the sender side while using the same basic wire protocol. It is RECOMMENDED that senders implement TFRC-SP and use the received bitmask to allow the sender to compute packer loss event rates. Senders MUST implement a retransmission and congestion control scheme no more aggressive then TFRC-SP.
In order to allow transport over datagram protocols, RELOAD messages may be fragmented. If a message is too large for a peer to transmit to the next peer it MUST fragment the message. Note that this implies that intermediate peers may re-fragment messages if the incoming and outgoing paths have different maximum datagram sizes. Intermediate peers SHOULD NOT reassemble fragments. Upon receipt of a fragmented message by the intended peer, the peer holds the fragments in a holding buffer until the entire message has been received. The message is then reassembled into a single unfragmented message and processed. In order to mitigate denial of service attacks, receivers SHOULD time out incomplete fragments. [[TODO: Describe algorithm]]
RELOAD provides a number of methods to establish and maintain connections between the nodes in the overlay.
A node sends a CONNECT request when it wishes to establish a direct TCP or UDP connection to another node for the purposes of sending RELOAD messages or application layer protocol messages, such as SIP. Detailed procedures for the CONNECT and its response are described in [XREF]. A CONNECT does not result in updating the routing table of either node. That function is performed by UPDATEs. If node A has CONNECTed to node B, it MAY route messages which are directly addressed to B through that channel but MUST NOT route messages through B to other peers via that channel.
A CONNECT_Q message contains the requesting peer's ICE connection parameters formatted into a binary structure.
; struct { opaque ufrag<0..2^8-1>; opaque password<0..2^8-1>; uint16 application; opaque fingerprint<0..2^8-1>; opaque role<0..2^8-1>; IceCandidate candidates<0..2^16-1>; } ConnectQA; ]]>
The values contained in ConnectQA are: The username fragment (from ICE) The ICE password. A 16-bit port number. This port number represents the IANA registered port of the protocol that is going to be sent on this connection. For SIP, this is 5060 or 5061, and for RELOAD is TBD. By using the IANA registered port, we avoid the need for an additional registry and allow RELOAD to be used to set up connections for any existing or future application protocol. One fingerprint attribute (from RFC 4572 ). An active/passive/actpass attribute from RFC 4145 . One or more ICE candidate values. Each candidate has an IP address, IP address family, port, transport protocol, priority, foundation, component ID, STUN type and related address. The candidate_list is a list of string candidate values. These values should be generated using the procedures of [XREF].
If a peer receives a CONNECT request, it SHOULD follow the procedures of [XREF] to process the request and generate its own response (a CONNECT_A) containing a ConnectQA. It should then begin ICE checks. When a peer receives a CONNECT response, it SHOULD parse the response and begin its own ICE checks.
PING is used to test connectivity along a path. A ping can be addressed to a specific Peer-ID or to the broadcast Peer-ID (all 1s). In either case, the target Peer-IDs respond with a simple response containing some status information.
The PING_Q message contains a list (potentially empty) of the pieces of status information that the requester would like the responder to provide.
; } PingQ ]]>
The two currently defined values for PingInformation are: indicates that the peer should Respond with the fraction of the overlay for which the responding peer is responsible. indicates that the peer should Respond with the number of resources currently being stored by the peer.
A successful PING_A response contains the information elements requested by the peer.
; } PingA; ]]>
A PING_A message contains the following elements: A randomly generated 64-bit response ID. This is used to distinguish PING responses in cases where the PING request is multicast. A sequence of PingInformation structures, as shown below. Each of the current possible PING information types is a 32-bit unsigned integer. For type "responsible_ppb", it is the fraction of the overlay for which the peer is responsible in parts per billion. For type "num_resources", it is the number of resources the peer is storing. The responding peer SHOULD include any values that the requesting peer requested and that it recognizes. They SHOULD be returned in the requested order. Any other values MUST NOT be returned.
A node sends a TUNNEL request when it wishes to exchange application-layer protocol messages without the expense of establishing a direct connection via CONNECT or when ICE is unable to establish a direct connection via CONNECT and a TURN relay is not available. The application-level protocols that are routed via the TUNNEL request are defined by that application's usage. The decision of whether to route application-level traffic across the overlay or to open a direct connection requires careful consideration of the overhead involved in each transaction. Establishing a direct connection requires greater initial setup costs, but after setup, communication is faster and imposes no overhead on the overlay. For example, for the SIP usage, an INVITE request to establish a voice call might be routed over the overlay, a SUBSCRIBE with regular updates would be better used with a CONNECT, and media would both impose too great a load on the overlay and likely receive unacceptable performance. However, there may be a tradeoff between locating TURN servers and relying on TUNNEL for packet routing. When a usage requires the TUNNEL method, it must specify the specific application protocol(s) that will be TUNNELed and for each protocol, specify: An application attribute that indicates the protocol being tunneled. This the IANA-registered port of the application protocol. The conditions under which the application will be TUNNELed over the overlay rather than using a direct CONNECT. A mechanism for moving future application-level communication from TUNNELing on the overlay to a direct CONNECTion, or an explanation why this is unnecessary. A means of associating messages together as required for dialog-oriented or request/response-oriented protocols. How the TUNNELed message (and associated responses) will be delivered to the correct application. This is particularly important if there might be multiple instances of the application on or behind a single peer.
The TUNNEL_Q message contains the application PDU that the requesting peer wishes to transmit, along with some control information identifying the handling of the PDU.
; opaque application_pdu<0..2^24-1>; } TunnelQ; ]]>
The values contained in the TUNNEL_Q are: A 16-bit port number. This port number represents the IANA registered port of the protocol that is going to be sent on this connection. For SIP, this is 5060 or 5061, and for RELOAD is TBD. By using the IANA registered port, we avoid the need for an additional registry and allow RELOAD to be used to set up connections for any existing or future application protocol. An arbitrary string providing an application-defined way of associating related TUNNELed messages. This attribute may also encode sequence information as required by the application protocol. An application PDU in the format specified by the application.
A TUNNEL_A message serves as confirmation that the message was received by the destination peer. It implies nothing about the processing of the application. If the application protocol specifies an acknowledgement or confirmation, that must be sent with a separate TUNNEL request. The TUNNEL_A message is empty (has a zero length payload)
[TODO: SAB]
RELOAD provides a set of generic mechanisms for storing and retrieving data in the DHT Instance. These mechanisms can be used for new applications simply by defining new code points and a small set of rules. No new protocol mechanisms are required. The basic unit of stored data is a single StoredData structure:
The contents of this structure are as follows: The length of the rest of the structure in octets. The time when the data was stored in absolute time, represented in seconds since the Unix epoch. Any attempt to store a data value with a storage time before that of a value already stored at this location MUST generate a 412 error. This prevents rollback attacks. Note that this does not require synchronized clocks: the receiving peer uses the storage time in the previous store, not its own clock. The validity period for the data, in seconds, starting from the time of store. The data value itself, as described in . A signature over the data value. describes the signature computation. The element is formatted as described in [TODO: this doesn't include the resource ID and kind to avoid duplicating it in each value. It would make things more self-contained, though.] Each resource-id specifies a single location in the DHT Instance. However, each location may contain multiple StoredData values distinguished by kind-id. The definition of a kind describes both the data values which may be stored and the data model of the data. Some data models allow multiple values to be stored under the same kind-id. Section describes the available data models. Thus, for instance, a given resource-id might contain a single-value element stored under kind-id X and an array containing multiple values stored under kind-id Y.
Each StoredData element is individually signed. However, the signature also must be self-contained and cover the kind-id and resource-id even though they are not present in the StoredData structure. The input to the signature algorithm is: resource_id + kind + StoredData Where these values are: The resource ID where this data is stored. The kind-id for this data. The contents of the stored data value, as described in the previous sections. [[TODO: Should we include the identity?.]] Once the signature has been computed, the signature is represented using a signature element, as described in .
The protocol currently defines the following data models: single value array dictionary These are represented with the StoredDataValue structure:
; } DataValue; select (DataModel) { case single_value: DataValue single_value_entry; case array: ArrayEntry array_entry; case DictionaryEntry: DictionaryEntry dictionary_entry; /* This structure may be extended */ } StoredDataValue; ]]>
We now discuss the properties of each data model in turn:
A single-value element is a simple, opaque sequence of bytes. There may be only one single-value element for each resource-id, kind-id pair. A single value element is represented as a DataValue, which contains the following two values: This value indicates whether the value exists at all. If it is set to False, it means that no value is present. If it is True, that means that a value is present. This gives the protocol a mechanism for indicating nonexistence as opposed to emptiness. The stored data.
An array is a set of opaque values addressed by an integer index. Arrays are zero based. Note that arrays can be sparse. For instance, a store of "X" at index 2 in an empty array produces an array with the values [ NA, NA, "X"]. Future attempts to fetch elements at index 0 or 1 will return values with "exists" set to False. A array element is represented as an ArrayEntry:
The contents of this structure are: The index of the data element in the array. Must be nonnegative or -1. The stored data.
A dictionary is a set of opaque values indexed by an opaque key with one value for each key. single dictionary entry is represented as follows A dictionary element is represented as a DictionaryEntry:
; struct { DictionaryKey key; DataValue value; } DictionaryEntry; ]]>
The contents of this structure are: The dictionary key for this value. The stored data.
RELOAD provides several methods for storing and retrieving data: STORE values in the overlay FETCH values from the overlay REMOVE values from the overlay FIND the values stored at an individual peer These methods are each described in the following sections.
The STORE method is used to store data in the overlay. The format of the STORE request depends on the data model which is determined by the kind.
A STORE_Q message is a sequence of StoreKindData values, each of which represents a sequence of stored values for a given kind. The same kind-id MUST NOT be used twice in a given store request. Each value is then processed in turn. These operations MUST be atomic. If any operation fails, the state MUST be rolled back to before the request was received. The store request is defined by the StoreQ structure:
; } StoreKindData; struct { ResourceId resource; StoreKindData kind_data<0..2^32-1>; } StoreQ; ]]>
A single STORE request stores data of a number of kinds to a single resource location. The contents of the structure are: The resource to store at. A series of elements, one for each kind of data to be stored. Each StoreKindData element represents the data to be stored for a single kind-id. The contents of the element are: The kind-id. Implementations SHOULD reject requests corresponding to unknown kinds unless specifically configured otherwise. The data model of the data. The kind defines what this has to be so this is redundant in the case where the software interpreting the messages understands the kind. The expected current state of the generation counter (approximately the number of times this object has been written, see below for details). The value or values to be stored. This may contain one or more stored_data values depending on the data model associated with each kind. The responsible peer MUST perform the following checks: The kind-id is known. The signature over the message is valid or (depending on overlay policy) no signature is required. The signatures over each individual data element (if any) are valid. Each element is signed by a credential which is authorized to write this kind at this resource-id If the generation-counter is non-zero, it must equal the current value of the generation-counter for this kind. This feature allows the generation counter to be used in a way similar to the HTTP Etag feature. The storage time values are greater than that of any value which would be replaced by this STORE. [[OPEN ISSUE: do peers need to save the storage time of REMOVEs to prevent reinsertion?]] If all these checks succeed, the peer MUST attempt to store the data values. If the store succeeds and the data is changed, then the peer must increase the generation counter by at least one. If there are multiple stored values in a single store_kind_data, it is permissible for the peer to increase the generation counter by only 1 for the entire kind-id, or by 1 or more than one for each value. The properties of stores for each data model are as follows: A store of a new single-value element creates the element if it does not exist and overwrites any existing value. with the new value. A store of an array entry replaces (or inserts) the given value at the location specified by the index. Because arrays are sparse, a store past the end of the array extends it with nonexistent values (exists=False) as required. A store at index -1, places the new value is placed at the end of the array regardless of the length of the the array. A store of a dictionary entry replaces (or inserts) the given value at the location specified by the dictionry key. The following figure shows the relationship between these structures for an example store which stores the following values at resource "1234" The value "abc" in the single value slot for kind X The value "foo" at index 0 in the array for kind Y The value "bar" at index 1 in the array for kind Y
In response to a successful STORE request the peer MUST return a STORE_A message containing a series of StoreKindResponse elements containing the current value of the generation counter for each kind-id, as well as a list of the peers where the data was replicated.
; } StoreKindResponse; struct { StoreKindResponse kind_responses<0..2^16-1>; } StoreA; ]]>
The contents of each StoreKindResponse are: The kind-id being represented. The current value of the generation counter for that kind-id. The list of other peers at which the data was/will-be replicated. In DHTs and applications where the responsible peer is intended to store redundant copies, this allows the storing peer to independently verify that the replicas were in fact stored by doing its own FETCH. The response itself is just StoreKindResponse values packed end-to-end. If any of the generation counters in the request precede the corresponding stored generation counter, then the peer MUST fail the entire request and respond with a 412 error. The error_info in the ErrorResponse MUST be a StoreA response containing the correct generation counter for each kind and empty replicas lists. [[TODO: The generation counter may need more thinking for uniqueness.]]
The FETCH request retrieves one or more data elements stored at a given resource-id. A single FETCH request can retrieve multiple differnt kinds.
; /* This structure may be extended */ } model_specifier; } StoredDataSpecifier; struct { ResourceId resource; StoredDataSpecifier specifiers<0..2^16-1>; } FetchQ; ]]>
The contents of the FETCH requests are as follows: The resource ID to fetch from. A sequence of StoredDataSpecifier values, each specifying some of the data values to retrieve. Each StoredDataSpecifier specifies a single kind of data to retrieve and (if appropriate) the subset of values that are to be retrieved. The contents of the StoredDataSpecifier structure are as follows: The kind-id of the data being fetched. Implementations SHOULD reject requests corresponding to unknown kinds unless specifically configured otherwise. The data model of the data. The last generation counter that the requesting peer saw. This may be used to avoid unnecessary fetches or it may be set to zero. The length of the rest of the structure, thus allowing extensibility. A reference to the data value being requested within the data model specified for the kind. For instance, if the data model is "array", it might specify some subset of the values. The model_specifier is as follows: If the data is of data model single value, the specifier is empty. If the data is of data model array, the specifier contains two integers. The first integer is the beginning of the range and the second is the end of the range. 0 is used to indicate the first element and -1 is used to indicate the final element. The beginning of the range MUST be earlier in the array then the end. If the data is of data model dictionary then the specifier contains a list of the dictionary keys being requested. If no keys are specified, than this is a wildcard fetch and all key-value pairs are returned. [[TODO: We really need a way to return only the keys. We'll need to modify this.]] The generation-counter is used to indicate the requester's expected state of the storing peer. If the generation-counter in the request matches the stored counter, then the storing peer returns a resone with no StoredData values rather than the stored data. Note that because the certificate for a user is typically stored at the same location as any data stored for that user, a requesting peer which does not already have the user's certificate should request the certificate in the FETCH as an optimization.
The response to a successful FETCH request is a FETCH_A message containing the data requested by the requester.
; } FetchKindResponse; struct { FetchKindResponse kind_responses<0..2^32-1>; } FetchA; ]]>
The FetchA structure contains a series of FetchKindResponse structures. There MUST be one FetchKindResponse element for each kind-id in the request. The contents of the FetchKindResponse structure are as follows: the kind that this structure is for. the generation counter for this kind. the relevant values. If the generation counter in the request matches the generation-counter in the stored data, then no StoredData values are returned. Otherwise, all relevant data values MUST be returned. A nonexistent value is represented with "exists" set to False.
The REMOVE request is used to remove a stored element or elements from the storing peer. Any successful remove of an existing element for a given kind MUST increment the generation counter by at least one.
; } RemoveQ; ]]>
A remove-request has exactly the same syntax as a FETCH request except that each entry represents a set of values to be removed rather than returned. The same kind-id MUST NOT be used twice in a given remove-request. Each specifier is then processed in turn. These operations MUST be atomic. If any operation fails, the state MUST be rolled back to before the request was received. Before processing the REMOVE request, the peer MUST perform the following checks. The kind-id is known. The signature over the message is valid or (depending on overlay policy) no signature is required. The signer of the message has permissions which permit him to remove this kind of data. Although each kind defines its own access control requirements, in general only the original signer of the data should be allowed to remove it. If the generation-counter is non-zero, it must equal the current value of the generation-counter for this kind. This feature allows the generation counter to be used in a way similar to the HTTP Etag feature. Assuming that the request is permitted, the operations proceed as follows.
A REMOVE of a single value element simple causes it not to exist. If no such element exists, then this simply is a silent success.
A REMOVE of an array element (or element range) replaces those elements with null elements. Note that this does not cause the array to be packed. An array which contains ["A", "B", "C"] and then has element 0 removed produces an array containing [NA, "B", "C"]. Note, however, that the removal of the final element of the array shortens the array, so in the above case, the removal of element 2 makes the array ["A", "B"].
A REMOVE of a dictionary element (or elements) replaces those elements with null elements. If no such elements exist, then this is a silent success.
The response to a successful REMOVE simply contains a list of the new generation counters for each kind-id, using the same syntax as the response to a STORE request. Note that if the generation counter does not change, that means that the requested items did not exist. However, if the generation counter does change, that does not mean that the items existed.
; } RemoveA; ]]>
The FIND request can be used to explore the DHT Instance. A FIND request for a resource-id R and a kind-id T retrieves the resource-id (if any) of the resource of kind T known to the target peer which is closes to R. This method can be used to walk the DHT Instance by interactively fetching R_n+1=nearest(1 + R_n).
The FIND_Q message contains a series of resource-IDs and kind-ids identifying the resource the peer is interested in.
; } FindQ; ]]>
The request contains a list of kind-ids which the FIND is for, as indicated below: The desired resource-id The desired kind-ids. Each value MUST only appear once.
A response to a successful FIND request is a FIND_A message containing the closest resource-ID for each kind specified in the request.
; } FindA; ]]>
If the processing peer is not responsible for the specified resource-id, it SHOULD return a 404 error. For each kind-id in the request the response MUST contain a FindKindData indicating the closest resource-id for that kind-id unless the kind is not allowed to be used with FIND in which case a find_kind_data for that kind_id MUST NOT be included in the response. If a kind-id is not known, then the corresponding resource-id MUST be 0. Note that different kind-ids may have different closest resource-ids. The response is simply a series of FindKindData elements, one per kind, concatenated end-to-end. The contents of each element are: The kind-id. The closest resource ID to the specified resource ID. This is 0 if no resource ID is known. Note that the response does not contain the contents of the data stored at these resource-ids. If the requester wants this, it must retrieve it using FETCH.
A new kind MUST define: The meaning of the data to be stored. The kind-id. The data model (single value, array, dictionary, etc.) Access control rules for indicating what credentials are allowed to read and write that kind-id at a given location. The minimum amounts of data that a conformant implementation MUST be willing to store. While each kind MUST define what data model is used for its data, that does not mean that it must define new data models. Where practical, kinds SHOULD use the built-in data models. However, they MAY define any new required data models. The intention is that the basic data model set be sufficient for most applications/usages. New usages MAY reuse existing kind-ids. New kind-ids only need to be defined where different data is stored or different behavior is required.
At numerous times during the operation of RELOAD, a node will need to establish a connection to another node. This may be for the purposes of building finger tables when the node joins the P2P network, or when the node learns of a new neighbor through an UPDATE and needs to establish a connection to that neighbor. In addition, a node may need to connect to another node for the purposes of an application connection. In the case of SIP, when a node has looked up the target AOR in the DHT Instance, it will obtain a Peer-ID that identifies that peer. The next step will be to establish a "direct" connection for the purposes of performing SIP signaling. In both of these cases, the node starts with a destination Peer-ID and its objective is to create a connection (ideally using TCP, but falling back to UDP when it is not available) to the node with that given Node-ID. The establishment of this connection is done using the CONNECT request in conjunction with ICE. It is assumed that the reader has familiarity with ICE. RELOAD implementations MUST implement full ICE. Because RELOAD always tries to use TCP and then UDP as a fallback, there will be multiple candidates of the same IP version, which requires full ICE.
To utilize ICE, the CONNECT method provides a basic offer/answer operation that exchanges a set of candidates for a single "stream". In this case, the "stream" refers not to RTP or other types of media, but rather to a connection for RELOAD itself or for SIP signaling. The CONNECT request contains the candidates for this stream, and the CONNECT response contains the corresponding answer with candidates for that stream. Though CONNECT provides an offer/answer exchange, it does not actually carry or utilize Session Description Protocol (SDP) messages. Rather, it carries the raw ICE parameters required for ICE operation, and the ICE spec is utilized as if these parameters had actually been used in an SDP offer or answer. In essence, ICE is utilized by mapping the CONNECT parameters into an SDP for the purposes of following the details of ICE itself. That avoids the need for RELOAD to respecify ICE, yet allows it to operate without the baggage that SDP would bring. In addition, RELOAD only allows for a single offer/answer exchange. Unlike the usage of ICE within SIP, there is never a need to send a subsequent offer to update the default candidates to match the ones selected by ICE. RELOAD and SIP always run over TLS for TCP connections and DTLS for UDP "connections". Consequently, once ICE processing has completed, both agents will begin TLS and DTLS procedures to establish a secure link. Its important to note that, had a TURN server been utilized for the TCP or UDP stream, the TURN server will transparently relay the TLS messaging and the encrypted TLS content, and thus will not have access to the contents of the connection once it is established. Any attack by the TURN server to insert itself as a man-in-the-middle are thwarted by the usage of the fingerprint mechanism of RFC 4572 , which will reveal that the TLS and DTLS certificates do not match the ones used to sign the RELOAD messages. An agent follows the ICE specification as described in and with the changes and additional procedures described in the subsections below.
ICE relies on the node having one or more STUN servers to use. In conventional ICE, it is assumed that nodes are configured with one or more STUN servers through some out-of-band mechanism. This is still possible in RELOAD but RELOAD also learns STUN servers as it connects to other peers. Because all RELOAD peers implement ICE and use STUN keepalives, every peer is a STUN server. Accordingly, any peer you know about will be willing to be a STUN server for you -- though of course it may be behind a NAT. A peer on a well-provisioned wide-area overlay will be configured with one or more bootstrap peers. These peers make an initial list of STUN servers. However, as the peer forms connections with additional peers, it builds more peers it can use as STUN servers. Because complicated NAT topologies are possible, a peer may need more than one STUN server. Specifically, a peer that is behind a single NAT will typically observe only two IP addresses in its STUN checks: its local address and its server reflexive address from a STUN server outside its NAT. However, if there are more NATs involved, it may discover that it learns additional server reflexive addresses (which vary based on where in the topology the STUN server is). To maximize the chance of achieving a direct connection, A peer SHOULD group other peers by the peer-reflexive addresses it discovers through them. It SHOULD then select one peer from each group to use as a STUN server for future connections. Only peers to which the peer currently has connections may be used. If the connection to that host is lost, it MUST be removed from the list of stun servers and a new server from the same group SHOULD be selected. OPEN ISSUE: should the peer try to keep at least one peer in each group, even if it has no other reason for the connection? Need to specify when to stop adding new groups if the peer is behind a really bad NAT. OPEN ISSUE: RELOAD-01 had a Peer-Info structure that allowed peers to exchange information such as a "default" IP-port pair in UPDATEs. This structure could be expanded to include the candidate list for a peer, thus allowing ICE negotiation to begin or even direct communication before a CONNECT request has been received. (The candidate pairs for the P2P port are fixed because the same source port is used for all connections.) However, because this would require significant changes to the ICE algorithm, we have not introduced such an extension at this point.
When a node wishes to establish a connection for the purposes of RELOAD signaling or SIP signaling (or any other application protocol for that matter), it follows the process of gathering candidates as described in Section 4 of ICE . RELOAD utilizes a single component, as does SIP. Consequently, gathering for these "streams" requires a single component. An agent MUST implement ICE-tcp , and MUST gather at least one UDP and one TCP host candidate for RELOAD and for SIP. The ICE specification assumes that an ICE agent is configured with, or somehow knows of, TURN and STUN servers. RELOAD provides a way for an agent to learn these by querying the ring, as described in [XREF] . The agent SHOULD prioritize its TCP-based candidates over its UDP-based candidates in the prioritization described in Section 4.1.2 of ICE . The default candidate selection described in Section 4.1.3 of ICE is ignored; defaults are not signaled or utilized by RELOAD.
Section 4.3 of ICE describes procedures for encoding the SDP. Instead of actually encoding an SDP, the candidate information (IP address and port and transport protocol, priority, foundation, component ID, type and related address) is carried within the attributes of the CONNECT request or its response. Similarly, the username fragment and password are carried in the CONNECT message or its response. describes the detailed attribute encoding for CONNECT. The CONNECT request and its response do not contain any default candidates or the ice-lite attribute, as these features of ICE are not used by RELOAD. The CONNECT request and its response also contain a application attribute, with a value of SIP or RELOAD, which indicates what protocol is to be run over the connection. The RELOAD CONNECT request MUST only be utilized to set up connections for application protocols that can be multiplexed with STUN and RELOAD itself. Since the CONNECT request contains the candidate information and short term credentials, it is considered as an offer for a single media stream that happens to be encoded in a format different than SDP, but is otherwise considered a valid offer for the purposes of following the ICE specification. Similarly, the CONNECT response is considered a valid answer for the purposes of following the ICE specification. Since all messages with RELOAD are secured between nodes, the node MUST implement the fingerprint attribute of RFC 4572 , and encode it into the CONNECT request and response as described in . This fingerprint will be matched with the certificates utilized to authenticate the RELOAD CONNECT request and its response. Similarly, the node MUST implement the active, passive, and actpass attributes from RFC 4145 . However, here they refer strictly to the role of active or passive for the purposes of TLS handshaking. The TCP connection directions are signaled as part of the ICE candidate attribute.
An agent MUST skip the verification procedures in Section 5.1 and 6.1 of ICE. Since RELOAD requires full ICE from all agents, this check is not required.
The roles of controlling and controlled as described in Section 5.2 of ICE are still utilized with RELOAD. However, the offerer (the entity sending the CONNECT request) will always be controlling, and the answerer (the entity sending the CONNECT response) will always be controlled. The connectivity checks MUST still contain the ICE-CONTROLLED and ICE-CONTROLLING attributes, however, even though the role reversal capability for which they are defined will never be needed with RELOAD. This is to allow for a common codebase between ICE for RELOAD and ICE for SDP.
The processes of forming check lists in Section 5.7 of ICE, scheduling checks in Section 5.8, and checking connectivity checks in Section 7 are used with RELOAD without change.
The controlling agent MUST utilize regular nomination. This is to ensure consistent state on the final selected pairs without the need for an updated offer, as RELOAD does not generate additional offer/answer exchanges. The procedures in Section 8 of ICE are followed to conclude ICE, with the following exceptions: The controlling agent MUST NOT attempt to send an updated offer once the state of its single media stream reaches Completed. Once the state of ICE reaches Completed, the agent can immediately free all unused candidates. This is because RELOAD does not have the concept of forking, and thus the three second delay in Section 8.3 of ICE does not apply.
An agent MUST NOT send a subsequent offer or answer. Thus, the procedures in Section 9 of ICE MUST be ignored.
STUN MUST be utilized for the keepalives described in Section 10 of ICE.
The procedures of Section 11 apply to RELOAD as well. However, in this case, the "media" takes the form of application layer protocols (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE processing completes, the agent will begin TLS or DTLS procedures to establish a secure connection. The fingerprint from the CONNECT request and its response are used as described in RFC 4572 , to ensure that another node in the P2P network, acting as a TURN server, has not inserted itself as a man-in-the-middle. Once the TLS or DTLS signaling is complete, the application protocol is free to use the connection. The concept of a previous selected pair for a component does not apply to RELOAD, since ICE restarts are not possible with RELOAD.
An agent MUST be prepared to receive packets for the application protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any time. The jitter and RTP considerations in Section 11 of ICE do not apply to RELOAD or SIP.
The Certificate Store usage allows a peer to store its certificate in the overlay, thus avoiding the need to send a certificate in each message - a reference may be sent instead. A user/peer MUST store its certificate at resource-ids derived from two Unhashed-IDs: The user names in the certificate. The Peer-IDs in the certificate. Note that in the second case the certificate is not stored at the peer's Peer-ID but rather at a hash of the peer's Peer-ID. The intention here (as is common throughout RELOAD) is to avoid making a peer responsible for its own data. A peer MUST ensure that the user's certificates are stored in the DHT Instance when joining and redo the check about every 24 hours after that. Certificate data should be stored with an expiry time of 60 days. When a client is checking the existence of data, if the expiry is less than 30 days, it should be refreshed to have an expiry of 60 days. The certificate information is frequently used for many operations, and peers should cache it for 8 hours. This usage defines the CERTIFICATE kind-id to store a peer or user's certificate. The data model for CERTIFICATE data is array. The CERTIFICATE MUST contain a Peer-ID or user name which, when hashed, maps to the resource-id at which the value is being stored. [TODO: EKR: Maximum size...]
The SIP usage allows a RELOAD overlay to be used as a distributed SIP registrar/proxy network. This entails three primary operations: Registering one's own AOR with the overlay. Looking up a given AOR in the overlay. Forming a direct connection to a given peer.
In ordinary SIP, a UA registers its AOR and location with a registrar. In RELOAD, this registrar function is provided by the overlay as a whole. To register its location, a RELOAD peer stores a SipRegistration structure under its own AOR. This uses the SIP-REGISTRATION kind-id, which is formally defined in . As a simple example, if Alice's AOR were "sip:alice@dht.example.com" and her Peer-ID were "1234", she might store the mapping "sip:alice@example.org -> 1234". This would tell anyone who wanted to call Alice to contact node "1234". RELOAD peers are allowed to store two kinds of SIP mappings: From AORs to destination lists (a single Peer-ID is just a trivial destination list. From AORs to other AORs. The meaning of the first kind of mapping is "in order to contact me, form a connection with this peer." The meaning of the second kind of mapping is "in order to contact me, dereference this AOR". This allows for forwarding. For instance, if Alice wants calls to her to be forwarded to her secretary, Sam, she might insert the following mapping "sip:alice@dht.example.org -> sip:sam@dht.example.org". The contents of a SipRegistration structure are as follows:
; case sip_registration_route: opaque contact_prefs<0..2^16-1>; Destination destination_list<0..2^16-1>; /* This type can be extended */ } SipRegistrationData; struct { SipRegistrationType type; uint16 length; SipRegistrationData data; } SipRegistration; ]]>
The contents of the SipRegistration PDU are: the type of the registration the length of the rest of the PDU the registration data If the registration is of type "sip_registration_uri", then the contents are an opaque string containing the URI. If the registration is of type "sip_registration_route", then the contents are an opaque string containing the callee's contact preferences and a destination list for the peer. RELOAD explicitly supports multiple registrations for a single AOR. The registrations are stored in a Dictionary with the dictionary keys being Peer-IDs. Consider, for instance, the case where Alice has two peers: her desk phone (1234) her cell phone (5678) Alice might store the following in the overlay at resource "sip:alice@dht.example.com". A SipRegistration of type "sip_registration_route" with dictionary key "1234" and value "1234". A SipRegistration of type "sip_registration_route" with dictionary key "5678" and value "5678". Note that this structure explicitly allows one Peer-ID to forward to another Peer-ID. For instance, Alice could set calls to her desk phone to ring at her cell phone. It's not clear that this is useful in this case, but may be useful if Alice has two AORs. [TODO: EKR: ??? ] In order to prevent hijacking, registrations are subject to access control rules. Before a STORE is permitted, the storing peer MUST check that: The certificate contains a username that is a SIP AOR that hashes to the resource-id being stored at. The certificate contains a Peer-ID that is the same as the dictionary key being stored at. Note that these rules permit Alice to forward calls to Bob without his permission. However, they do not permit Alice to forward Bob's calls to her.
When a RELOAD user wishes to call another user, starting with a non-GRUU AOR, he follows the following procedure. (GRUUs are discussed in [XREF]). Check to see if the domain part of the AOR matches the domain name of an overlay of which he is a member. If not, then this is an external AOR, and he MUST do one of the following: Fail the call. Use ordinary SIP procedures. Attempt to become a member of the overlay indicated by the domain part (only possible if the enrollment procedure defined in [XREF] indicates that this is a RELOAD overlay.) Perform a FETCH for kind SIP-REGISTRATION at the resource-id corresponding to the AOR. This FETCH SHOULD not indicate any dictionary keys, which will result in fetching all the stored values. If any of the results of the FETCH are non-GRUU AORs, then repeat step 1 for that AOR. Once only GRUUs and destination lists remain, the peer removes duplicate destination lists and GRUUs from the list and forms a SIP connection to the appropriate peers as described in the following section. If there are also external AORs, the peer follows the appropriate procedure for contacting them as well.
Once the peer has translated the AOR into a set of destination lists, it then uses the overlay to route CONNECT messages to each of those peers. The "application" field MUST be 5160 to indicate SIP. If certificate-based authentication is in use, the responding peer MUST present a certificate with a Peer-ID matching the terminal entry in the route list. Note that it is possible that the peers already have a RELOAD connection between them. This MUST NOT be used for SIP messages. However, if a SIP connection already exists, that MAY be used. Once the CONNECT succeeds, the peer sends SIP messages over the connection as in normal SIP.
GRUUs do not require storing data in the DHT Instance. Rather, they are constructed by embedding a base64-encoded destination list in the gr URI parameter of the GRUU. The base64 encoding is done with the alphabet specified in table 1 of RFC 4648 with the exception that ~ is used in place of =. An example GRUU is "sip:alice@example.com;gr=MDEyMzQ1Njc4OTAxMjM0NTY3ODk~". When a peer needs to route a message to a GRUU in the same P2P network, it simply uses the destination list and connects to that peer. Because a GRUU contains a destination list, it MAY have the same contents as a destination list stored elsewhere in the resource dictionary. Anonymous GRUUs are done in roughly the same way but require either that the enrollment server issue a different Peer-ID for each anonymous GRUU required or that a destination list be used that includes a peer that compresses the destination list to stop the Peer-ID from being revealed.
The first mapping is provided using the SIP-REGISTRATION kind-id: The Unhashed-ID for the SIP-REGISTRATION kind-id is the AOR of the user. The data stored is a SipRegistrationData, which can contain either another URI or a destination list to the peer which is acting for the user. The data model for the SIP-REGISTRATION kind-id is dictionary. The dictionary key is the Peer-ID of the storing peer. This allows each peer (presumably corresponding to a single device) to store a single route mapping. If certificate-based access control is being used, stored data of kind-id SIP-REGISTRATION must be signed by a certificate which (1) contains user name matching the storing URI used as the Unhashed-ID for the resource-id and (2) contains a Peer-ID matching the storing dictionary key. Peers MUST be prepared to store SIP-REGISTRATION values of up to 10 kilobytes and must be prepared to store up to 10 values for each user name. Data stored under the SIP-REGISTRATION kind is of type SipRegistration. This comes in two varieties: a URI which the user can be reached at. a destination list which can be used to reach the user's peer.
This usage allows two peers to exchange SIP messages across the overlay using the TUNNEL method. TUNNEL is provided as an alternative to using CONNECT because it allows a SIP message to be sent immediately, without the delay associated with CONNECT. For a simple SIP exchange, it may result in fewer messages being sent. An implementation SHOULD use CONNECT for a dialog that is expected to endure for sufficient time and exchange significant numbers of messages. An implementation MAY establish an initial dialog using TUNNELing and then migrate it to a direct dialog opened with CONNECT once that negotiation is complete. As an application of TUNNEL, this usage defines the following items: For SIP, the application attribute is 5060. The application MAY establish any dialog using TUNNEL if it expects to replace it once a CONNECT request completes. The application SHOULD NOT exchange messages with another SIP UA repeatedly using a TUNNEL unless it is unable to complete a CONNECT. The Replaces header should be used to migrate dialogs established via TUNNEL to a direct connection. The dialogid is the GRUU of the destination of the request. By using the GRUU of the destination as the dialogid, the receiving peer is able to deliver the message to the appropriate process without parsing the SIP message. In constructing the message, the SIP UA forms the message as if it were being routed directly to the GRUU of the destination. The SIP stack hands the message to RELOAD for delivery. Although the message is passed through a sequence of untrusted peers, it is not subject to modification by those peers because of the message's signature. OPEN ISSUE: should specify how to request encryption of the message end-to-end. The easiest implementation of TUNNEL is likely to default to sending all messages across a TUNNEL when the first message is sent to a new destination GRUU and simultaneously issuing a CONNECT. Messages then continue through the TUNNEL until the CONNECT completes, at which point they are delivered via the new connection. OPEN ISSUE: If the tunneling vs direct decision can be made equivalently to a link-layer decision, it may not be necessary to modify the dialog or inform the SIP UA in any way that it has now obtained a direct route.
[TODO: SAB] [[TODO: reduce text of motivation description in the next version]] The development and deployment of a peer-to-peer system is a continuous process. The developers write code which is tested on a scale that may be smaller than the actual deployment size. After this local testing, the code is deployed in a real environment. Bugs arise during development and deployment phases. The designers of the peer-to-peer system need mechanisms which can help identify problems and bugs in a peer-to-peer system during development and deployment phases. Peer-to-peer systems are an example of a distributed system and it is not a trivial task to provide protocol mechanisms, tools and techniques to identify problems that may arise in such systems. The diagnostic mechanisms can broadly be classified into online and offline mechanisms. The online mechanisms attempt to identify faults in a running system where as offline mechanisms try to infer faults by gathering the log files of machines participating in a distributed system. In a peer-to-peer system, a peer maintains routing state to forward messages according to the overlay protocol being used. In addition, a peer stores information published by other peers. The routing and storage of resources consume network, space (memory), and CPU resources. A peer also needs to keep track of how long the P2PSIP application has been running and the last time peers in the routing table were last contacted. During development and deployment phase, an overlay designer needs mechanisms to query some or all of the above mentioned information. The overlay designer may also treat overlay as a black box and determine if the routing mechanisms are working correctly under various levels of churn. Thus, there are at least two types of online diagnostic mechanisms: 1) state acquisition 2) black-box diagnostics
The protocol provides a DIAGNOSTIC method [TODO] which queries the peer for its routing state, average bandwidth, CPU utilization, and storage state. The state acquisition mechanism can be used to construct a local view of the connectivity state of the system. It can also be used to construct a geographical map of the system. Below, we identify potential issues with the state acquisition mechanisms. Security: If any peer can query the routing or storage state of any other peer, then clearly privacy and security concerns arise. To address this, the state acquisition mechanisms need an access list like mechanism so that only the overlay implementer can query the state of all the nodes. Alternatively, the state acquisition mechanisms are only enabled during the development phase or are only enabled for 'admin' users. Scalability: It is possible to query the state of few hundred or a few thousand nodes (as it is currently done in our live system on Planet lab); however, a serial state acquisition of a million node is a non starter. In large scale networks, one option is to query the state of few hundred nodes and to construct an high level connectivity map. CAIDA [ref] collects data at a few vantage points to construct BGP maps. Instantaneous vs. long term state: Another issue with these state acquisitions mechanisms is whether they acquire the instantaneous state snapshot or an exponential moving average or a list of snapshots over a period of time. For diagnostic metrics such as CPU utilization, an exponential moving average metric is also helpful in addition to the instantaneous snapshot. Pull vs. push: The state acquisition mechanisms can either be pull-based or push-based or a combination of both. In pull-based mechanisms, peer explicitly request state of another peer. This may not be sufficient because pull-based mechanisms require a to periodically poll a peer for any change state. In a push-based mechanism, peers advertise any change in certain metrics to their routing or neighbor peers. As an example of push-based mechanism, a peer which starts to relay a call may indicate a change in its bandwidth to its routing or neighbor peers in a PING message. Development vs. deployment: A hard problem is to decide which diagnostics are absolutely necessary during deployment and which are needed during development. Clearly, complete state acquisition has security concerns in a deployed system. The other option an overlay implementer can use is to run a few peers and have complete control over the functionality of these peers. These peers are same as other peers with the difference that an overlay implementer can explicitly query the state of these peers. It can then use this information to 'crawl' the overlay network and construct a local map of the network.
[[TODO: a better name for this section]] Black-box diagnostics: DHTs are examples of structured peer-to-peer networks and they allow nodes to store key/value pairs in the overlay. A simple diagnostic mechanism is to treat the overlay as a black-box: publish several key/value pairs at one peer and then look them up from another peer. For this kind of diagnostic mechanism, clients are more suitable as they do not provide any routing or storage services to the overlay and can connect to an arbitrary peer.
The Diagnostic Usage allow a peer to report various statistics about itself that may be useful for diagnostics or performance management. It can be used to discover information such as the software version, uptime, and performance statistics of a peer. The usage defines several new kinds which can be retrieved to get the statistics. The Peer-ID is directly used when retrieving data so no Unhashed-ID is defined. The access control model for all of these is local policy defined by the peer. The peer MAY have a list of users (such as "admin") that it is willing to return the information for and restrict access to users with that name. The access control can be determined on a per kind basis - for example, a node may be willing to return the software version to any users while specific information about performance may not be returned. The following kinds are defined: A single value element containing a US-ASCII string that identifies the manufacture, model, and version of the software. A single value element containing an unsigned 64-bit integer specifying the time the nodes has been up in seconds. A single value element containing the Autonomous System [TODO REF] number as an unsigned 32-bit integer. Zero is returned if the AS number is unknown. (OPEN ISSUES: How to determine a AS number? This metric is primarily used for advertising and locating STUN/TURN servers. A TURN server is inserted and looked up under H(AS). What if there are no TURN servers in the same AS? ) [[TODO: I propose we remove this unless we can say how to compute it. I note most the software I have seen just uses the table lookup on IP address - if this is the case it is probably better just to return IP address of NAT. ]] A single value element containing an unsigned 8-bit integer representing the percentage CPU load from 1 to 100. (OPEN ISSUE: It is not a very precise metric.) A single value element containing an unsigned 64-bit integer representing the number of bytes of data being stored by this node. An array element containing the number of messages sent and received. The array is indexed by method code. Each entry in the array is a pair of unsigned 64-bit integers (packed end to end) representing sent and received. An array element containing the number of instances of each kind stored. The array is index by kind-id. Each entry is an unsigned 64-bit integer. A single value element containing an unsigned 32-bit integer representing the number of peers in the node's routing table. A single value element containing an unsigned 32-bit integer representing the number of peers in the node's neighbor table. A single value element containing an unsigned 32-bit integer representing an exponential weighted average of bytes sent by this peer. [[ TODO : Bruce or SAB - say how to compute this ]] A single value element containing an unsigned 32-bit integer representing an exponential weighted average of bytes received by this peer. A single value element containing an unsigned 32-bit integer specifying the time in number of seconds the node was last contacted. A single value element containing an unsigned 32-bit integer representing the memory footprint of the peer program in kilo bytes. A single value element containing an unsigned 32-bit integer specifying the recent RTT estimate in ms between two peers. [[TODO: We would like some sort of bandwidth measurement, but we're kind of unclear on the units and representation.]]
Clearly, all diagnostic metrics are useful during development and testing. The hard question is which metrics are absolutely necessary for a deployed P2PSIP system. We attempt to identify these metrics and classify them under 'resource' and 'peer' metrics. For 'resource' metric, we identify CPU_UTILIZATION, EWMA_BYTES_SENT, EWMA_BYTES_RCVD, and MEMORY_FOOTPRINT as the key metrics and for 'peer' metric we identify UPTIME, LAST_CONTACT, and RTT as the metrics that are crucial for a deployed P2PSIP system. (OPEN QUESTION: any other metrics?) (OPEN: Below, we sketch how these metrics can be used. A peer can use EWMA_BYTES_SENT and EWMA_BYTES_RCVD of another peer to infer whether it is acting as a media relay. It may then choose not to forward any requests for media relay to this peer. Similarly, among the various candidates for filling up routing table, a peer may prefer a peer with a large UPTIME value, small RTT, and small LAST_CONTACT value. )
[TODO: BBL] This algorithm is assigned the name chord-128-2-16+ to indicate it is based on Chord, uses a SHA-1 then truncates that to 128 bit for the hash function, stores 2 redundant copies of all data, and has finger tables with at least 16 entries.
The algorithm described here is a modified version of the Chord algorithm. Each peer keeps track of a finger table of 16 entries and a neighborhood table of 6 entries. The neighborhood table contains the 3 peers before this peer and the 3 peers after it in the DHT ring. The first entry in the finger table contains the peer half-way around the ring from this peer; the second entry contains the peer that is 1/4 of the way around; the third entry contains the peer that is 1/8th of the way around, and so on. Fundamentally, the chord data structure can be thought of a doubly-linked list formed by knowing the successors and predecessor peers in the neighborhood table, sorted by the Peer-ID. As long as the successor peers are correct, the DHT will return the correct result. The pointers to the prior peers are kept to enable inserting of new peers into the list structure. Keeping multiple predecessor and successor pointers makes it possible to maintain the integrity of the data structure even when consecutive peers simultaneously fail. The finger table forms a skip list, so that entries in the linked list can rapidly be found - it needs to be there so that peers can be found in O(log(N)) time instead of the typical O(N) time that a linked list would provide. A peer, n, is responsible for a particular Resource-ID k if k is less than or equal to n and k is greater than p, where p is the peer id of the previous peer in the neighborhood table. Care must be taken when computing to note that all math is modulo 2^128.
If a peer is not responsible for a Resource-ID k, then it routes a request to that location by routing it to the peer in either the routing or connection table that has the largest Peer-ID that is in the interval between the peer and k.
When a peer receives a STORE request for Resource-ID k, and it is responsible for Resource-ID k, it stores the data and returns a SUCCESS response. [[Open Issue: should it delay sending this SUCCESS until it has successfully stored the redundant copies?]]. It then sends a STORE request to its successor in the neighborhood table and to that peers successor. Note that these STORE requests are addressed to those specific peers, even though the Resource-ID they are being asked to store is outside the range that they are responsible for. The peers receiving these check they came from an appropriate predecessor in their neighborhood table and that they are in a range that this predecessor is responsible for, and then they store the data. [[ TODO - make it clear nodes storing look at resource-ID and what they are responsible for to decide if they need to the redudant stores since they are the "master" copy. ]] Note that a malicious node can return a success response but not store the data locally or in the replica set. Requesting peers which wish to ensure that the replication actually occurred SHOULD contact each peer listed in the replicas field of the STORE response and retrieve a copy of the data. [[TODO: Do we want to have some optimization in FETCH where they can retrieve just a digest instead of the data values?]]
The join process for a joining party (JP) with Peer-ID n is as follows. JP connects to its chosen bootstrap node. JP uses a series of PINGs to populate its routing table. JP sends CONNECT requests to initiate connections to each of the peers in the connection table as well as to the desired finger table entries. Note that this does not populate their routing tables, but only their connection tables, so JP will not get messages that it is expected to route to other nodes. JP enters all the peers it contacted into its routing table. JP sends a JOIN to its immediate successor, the admitting peer (AP) for Peer-ID n. The AP sends the response to the JOIN. AP does a series of STORE requests to JP to store the data that JP will be responsible for. AP sends JP an UPDATE explicitly labeling JP as its predecessor. At this point, JP is part of the ring and responsible for a section of the overlay. AP can now forget any data which is assigned to JP and not AP. AP sends an UPDATE to all of its neighbors with the new values of its neighbor set (including JP). JP sends UPDATES to all the peers in its routing table. In order to populate its routing table, JP sends a PING via the bootstrap node directed at resource-id n+1 (directly after its own resource-id). This allows it to discover its own successor. Call that node p0. It then sends a ping to p0+1 to discover its successor (p1). This process can be repeated to discover as many successors as desired. The values for the two peers before p will be found at a later stage when n receives an UPDATE. In order to set up its neighbor table entry for peer i, JP simply sends a CONNECT to peer (n+2^(numBitsInPeerId-i). This will be routed to a peer in approximately the right location around the ring.
When a peer needs to CONNECT with a new peer in its neighborhood table, it MUST source-route the CONNECT request through the peer from which it learned the new peer's Peer-ID. Source-routing these requests allows the overlay to recover from instability. All other CONNECT requests, such as those for new finger table entries, are routed conventionally through the overlay. If a peer is unable to successfully CONNECT with a peer that should be in its neighborhood, it MUST locate either a TURN server or another peer in the overlay, but not in its neighborhood, through which it can exchange messages with its neighbor peer
A chord UPDATE is defined as
; PeerId successors<0..2^16-1>; } ChordUpdate; ]]>
The contents of this message are: The predecessor set of the UPDATEing peer. The successor set of the UPDATEing peer. A peer MUST maintain an association (via CONNECT) to every member of its neighbor set. A peer MUST attempt to maintain at least three predecessors and three successors. However, it MUST send its entire set in any UPDATE message.
Every time a connection to a peer in the neighborhood set is lost (as determined by connectivity pings or failure of some request), the peer should remove the entry from its neighborhood table and replace it with the best match it has from the other peers in its routing table. It then sends an UPDATE to all its remaining neighbors. The update will contain all the Peer-IDs of the current entries of the table (after the failed one has been removed). Note that when replacing a successor the peer SHOULD delay the creation of new replicas for 30 seconds after removing the failed entry from its neighborhood table in order to allow a triggered update to inform it of a better match for its neighborhood table. If connectivity is lost to all three of the peers that succeed this peer in the ring, then this peer should behave as if it is joining the network and use PINGs to find a peer and send it a JOIN. If connectivity is lost to all the peers in the finger table, this peer should assume that it has been disconnected from the rest of the network, and it should periodically try to join the DHT.
When a peer, N, receives an UPDATE request, it examines the Peer-IDs in the UPDATE_Q and at its neighborhood table and decides if this UPDATE_Q would change its neighborhood table. This is done by taking the set of peers currently in the neighborhood table and comparing them to the peers in the update request. There are three major cases: The UPDATE_Q contains peers that would not change the neighbor set because they match the neighborhood table. The UPDATE_Q contains peers closer to N than those in its neighborhood table. The UPDATE_Q defines peers that indicate a neighborhood table further away from N than some of its neighborhood table. Note that merely receiving peers further away does not demonstrate this, since the update could be from a node far away from N. Rather, the peers would need to bracket N. In the first case, no change is needed. In the second case, N MUST attempt to CONNECT to the new peers and if it is successful it MUST adjust its neighbor set accordingly. Note that it can maintain the now inferior peers as neighbors, but it MUST remember the closer ones. The third case implies that a neighbor has disappeared, most likely because it has simply been disconnected but perhaps because of overlay instability. N MUST PING the questionable peers to discover if they are indeed missing and if so, remove them from its neighborhood table. After any PINGs and CONNECTs are done, if the neighborhood table changes, the peer sends an UPDATE request to each of its neighbors that was in either the old table or the new table. These UPDATE requests are what ends up filling in the predecessor/successor tables of peers that this peer is a neighbor to. A peer MUST NOT enter itself in its successor or predecessor table and instead should leave the entries empty. A peer N which is responsible for a resource-id R discovers that the replica set for R (the next two nodes in its successor set) has changed, it MUST send a STORE for any data associated with R to any new node in the replica set. It SHOULD not delete data from peers which have left the replica set. When a peer N detects that it is no longer in the replica set for a resource R (i.e., there are three predecessors between N and R), it SHOULD delete all data associated with R from its local store.
There are four components to stabilization: exchange UPDATES will all peers in its routing table to exchange state search for better peers to place in its finger table search to determine if the current finger table size is sufficiently large search to determine if the overlay has partitioned and needs to recover A peer MUST periodically send an UPDATE request to every peer in its routing table. The purpose of this is to keep the predecessor and successor lists up to date and to detect connection failures. The default time is about every ten minutes, but the enrollment server SHOULD set this in the configuration document using the "chord-128-2-16+-update-frequency" element (denominated in seconds.) A peer SHOULD randomly offset these UPDATE requests so they do not occur all at once. If an UPDATE request fails or times out, the peer MUST mark that entry in the neighbor table invalid and attempt to reestablish a connection. If no connection can be established, the peer MUST attempt to establish a new peer as its neighbor and do whatever replica set adjustments are required. Periodically a peer should select a random entry i from the finger table and do a PING to peer (n+2^(numBitsInPeerId-i). The purpose of this is to find a more accurate finger table entry if there is one. This is done less frequently than the connectivity checks in the previous section because forming new connections is somewhat expensive and the cost needs to be balanced against the cost of not having the most optimal finger table entries. The default time is about every hour, but the enrollment server SHOULD set this in the configuration document using the "chord-128-2-16+-ping-frequency" element (denominated in seconds). If this returns a different peer than the one currently in this entry of the peer table, then a new connection should be formed to this peer and it should replace the old peer in the finger table. As an overlay grows, more than 16 entries may be required in the finger table for efficient routing. To determine if its finger table is sufficiently large, one an hour the peer should perform a PING to determine whether growing its finger table by four entries would result in it learning at least two peers that it does not already have in its neighbor table. If so, then the finger table SHOULD be grown by four entries. Similarly, if the peer observes that its closest finger table entries are also in its neighbor table, it MAY shrink its finger table to the minimum size of 16 entries. [[OPEN ISSUE: there are a variety of algorithms to gauge the population of the overlay and select an appropriate finger table size. Need to consider which is the best combination of effectiveness and simplicity.]] To detect that a partitioning has occurred and to heal the overlay, a peer P MUST periodically repeat the discovery process used in the initial join for the overay to locate an appropriate bootstrap peer, B. If an overlay has multiple mechanisms for discovery it should randomly select a method to locate a bootstrap peer. P should then send a PING for its own Peer-ID routed through B. If a response is received from a peer S', which is not P's successor, then the overlay is partitioned and P should send a CONNECT to S' routed through B, followed by an UPDATE sent to S'. (Note that S' may not be in P's neighborhood table once the overlay is healed, but the connection will allow S' to discover appropriate neighbor entries for itself via its own stabilization.)
Peers SHOULD send a LEAVE request prior to exiting the DHT Instance. Any peer which receives a LEAVE for a peer n in its neighbor set must remove it from the neighbor set, update its replica sets as appropriate (including STOREs of data to new members of the replica set) and send UPDATEs containing its new predecessor and successor tables.
When a peer first joins a new overlay, it starts with a discovery process to find an enrollment server. Related work to the approach used here is described in and . The peer first determines the overlay name. This value is provided by the user or some other out of band provisioning mechanism. If the name is an IP address, that is directly used otherwise the peer MUST do a DNS SRV query using a Service name of "p2p_enroll" and a protocol of tcp to find an enrollment server. If the overlay name ends in .local, then the DNS SRV lookup is done using implement with a Service name of "p2p_menroll" can also be tried to find an enrollment server. If they implement this, the user name MAY be used as the Instance Identifier label. Once an address for the enrollment servers is determined, the peer forms an HTTPS connection to that IP address. The certificate MUST match the overlay name as described in . The peer then performs a GET to the URL formed by appending a path of "/p2psip/enroll" to the overlay name. For example, if the overlay name was example.com, the URL would be "https://example.com/p2psip/enroll". The result is an XML configuration file with the syntax described in the following section.
This specification defines a new content type "application/p2p-overlay+xml" for an MIME entity that contains overlay information. This information is fetched from the enrollment server, as described above. An example document is shown below.
[PEM encoded certificate here] ]]>
The file MUST be a well formed XML document and it SHOULD contain an encoding declaration in the XML declaration. If the charset parameter of the MIME content type declaration is present and it is different from the encoding declaration, the charset parameter takes precedence. Every application conferment to this specification MUST accept the UTF-8 character encoding to ensure minimal interoperability. The namespace for the elements defined in this specification is urn:ietf:params:xml:ns:p2p:overlay. The file can contain multiple "overlay" elements where each one contains the configuration information for a different overlay. Each "overlay" has the following attributes: name of the overlay time in future at which this overlay configuration is not longer valid and need to be retrieved again. This is expressed in seconds from the current time. Inside each overlay element, the following elements can occur: This element has an attribute called name that describes which DHT algorithm is being used. This element contains a PEM encoded X.509v3 certificate that is the root trust store used to sign all certificates in this overlay. There can be more than one of these. This element has an attribute called "name" that describes a usage that peers in this overlay are required to support. More than one required-usage element may be present. This element contains the URL at which the credential server can be reached in a "url" element. This URL MUST be of type "https:". More than one credential-server element may be present. This elements represents the address of one of the bootstrap peers. It has an attribute called "address" that represents the IP address (either IPv4 or IPv6, since they can be distinguished) and an attribute called "port" that represents the port. More than one bootstrap-peer element may be present. This element represents the address of a multicast address and port that may be used for bootstrap and that peers SHOULD listen on to enable bootstrap. 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. This element indicates that iterative routing (see ) MAY be used. If iterative routing is permitted, then this value MUST be set to "TRUE". Otherwise, it SHOULD be absent, but MAY be set to "FALSE". Base URL for credential server. If shared secret mode is used, this contains the shared secret. [[TODO: Do a RelaxNG grammar.]]
If the configuration document contains a credential-server element, credentials are required to use the DHT Instance. A peer which does not yet have credentials MUST contact the credential server to acquire them. In order to acquire credentials, the peer generates an asymmetric key pair and then generates a "Simple Enrollment Request" (as defined in ) and sends this over HTTPS as defined in to the URL in the credential-server element. The subjectAltName in the request MUST contain the required user name. The credential server MUST authenticate the request using the proivded user name and password. If the authentication succeeds and the requested user name is acceptable, the server and returns a certificate. The SubjectAltName field in the certificate contains the following values: One or more Peer-IDs which MUST be cryptographically random . These MUST be chosen by the credential server in such a way that they are unpredictable to the requesting user. The names this user is allowed to use in the overlay The certificate is returned in a "Simple Enrollment Response". [[TODO: REF]] The client MUST check that the certificate returned was signed by one of the certificates received in the "root-cert" list of the overlay configuration data. The peer then reads the certificate to find the Peer-IDs it can use.
In order to join the overlay, the peer MUST contact a peer. Typically this means contacting the bootstrap peers, since they are guaranteed to have public IP addresses (the system should not advertise them as bootstrap peers otherwise). If the peer has cached peers it SHOULD contact them first by sending a PING request to the known peer address with the destination Peer-ID set to that peer's Peer-ID. If no cached peers are available, then the peer SHOULD send a PING request to the address and port found in the broadcast-peers element in the configuration document. This MAY be a multicast or anycast address. The PING should use the wildcard Peer-ID as the destination Peer-ID. The responder peer that receives the PING request SHOULD check that the overlay name is correct and that the requester peer sending the request has appropriate credentials for the overlay before responding to the PING request even if the response is only an error. When the requester peer finally does receive a response from some responding peer, it can note the Peer-ID in the response and use this Peer-ID to start sending requests to join the DHT Instance as described in and [XREF]. After a peer has successfully joined the overlay network, it SHOULD periodically look at any peers to which it has managed to form direct connections. Some of these peers MAY be added to the cached-peers list and used in future boots. Peers that are not directly connected MUST NOT be cached. The RECOMMENDED number of peers to cache is 10.
[TODO: SAB]
RELOAD provides a generic storage service, albeit one designed to be useful for P2P SIP. In this section we discuss security issues that are likely to be relevant to any usage of RELOAD. In we describe issues that are specific to SIP. In any DHT Instance, any given user depends on a number of peers with which they have no well-defined relationship except that they are fellow members of the DHT Instance. In practice, these other nodes may be friendly, lazy, curious, or outright malicious. No security system can provide complete protection in an environment where most nodes are malicious. The goal of security in RELOAD is to provide strong security guarantees of some properties even in the face of a large number of malicious nodes and to allow the DHT to function correctly in the face of a modest number of malicious nodes. P2PSIP deployments require the ability to authenticate both peers and resources (users) without the active presence of a trusted entity in the system. We describe two mechanisms. The first mechanism is based on public key certificates and is suitable for general deployments. The second is based on an overlay-wide shared symmetric key and is suitable only for limited deployments in which the relationship between admitted peers is not adversarial.
The two basic functions provided by DHT nodes are storage and routing: some node is responsible for storing a peer's data and for allowing a peer to fetch other peer's data. Some other set of nodes are responsible for routing messages to and from the storing nodes. Each of these issues is covered in the following sections. P2P overlays are subject to attacks by subversive nodes that may attempt to disrupt routing, corrupt or remove user registrations, or eavesdrop on signaling. The certificate-based security algorithms we describe in this draft are intended to protect DHT routing and user registration information in RELOAD messages. To protect the signaling from attackers pretending to be valid peers (or peers other than themselves), the first requirement is to ensure that all messages are received from authorized members of the overlay. For this reason, RELOAD transports all messages over a secure channel (TLS and DTLS are defined in this document) which provides message integrity and authentication of the directly communicating peer. In addition, when the certificate-based security system is used, messages and data are digitally signed with the sender's private key, providing end-to-end security for communications.
This specification stores users' registrations and possibly other data in a Distributed Hash table (DHT). This requires a solution to securing this data as well as securing, as well as possible, the routing in the DHT. Both types of security are based on requiring that every entity in the system (whether user or peer) authenticate cryptographically using an asymmetric key pair tied to a certificate. When a user enrolls in the DHT Instance, they request or are assigned a unique name, such as "alice@dht.example.net". These names are unique and are meant to be chosen and used by humans much like a SIP Address of Record (AOR) or an email address. The user is also assigned one or more Peer-IDs by the central enrollment authority. Both the name and the peer ID are placed in the certificate, along with the user's public key. Each certificate enables an entity to act in two sorts of roles: As a user, storing data at specific Resource-IDs in the DHT Instance corresponding to the user name. As a DHT peer with the peer ID(s) listed in the certificate. Note that since only users of this DHT Instance need to validate a certificate, this usage does not require a global PKI. It does, however, require a central enrollment authority which acts as the certificate authority for the DHT Instance. This authority signs each peer's certificate. Because each peer possesses the CA's certificate (which they receive on enrollment) they can verify the certificates of the other entities in the overlay without further communication. Because the certificates contain the user/peer's public key, communications from the user/peer can be verified in turn. Because all stored data is signed by the owner of the data the the storing peer can verify that the storer is authorized to perform a store at that resource-id and also allows any consumer of the data to verify the provenance and integrity of the data when it retrieves it. All implementations MUST implement certificate-based security.
For small environments where deployment of the PKI necessary to use a certificate-based model is impractical, RELOAD supports a shared secret security that relies on a single key that is shared among all members of the overlay. It is appropriate for small groups that wish to form a private network without complexity. In shared secret mode, all the peers share a single symmetric key which is used to key TLS-PSK or TLS-SRP mode. A peer which does not know the key cannot form TLS connections with any other peer and therefore cannot join the overlay. The shared-secret scheme prohibits unauthorized peers from joining the overlay, but it provides no protection from a compromised peer inserting arbitrary resource registrations, performing a Sybil attack, or performing other attacks on the resources or routing. Thus, it is only safe to use in limited settings in which peers are not adversarial. In addition, because the messages and data are not authenticated, each intermediate peer MUST take care to use TLS and check the other peer's knowledge of the shared secret, or message insertion is possible. If the shared secret key for the shared-key security scheme is discovered by an attacker, then most of the security of the scheme is lost: an attacker can impersonate any peer to any other peer. Thus, the shared-secret scheme is only appropriate for small deployments, such as a small office or ad hoc overlay set up among participants in a meeting. One natural approach to a shared-secret scheme is to use a user-entered password as the key. The difficulty with this is that in TLS-PSK mode, such keys are very susceptible to dictionary attacks. If passwords are used as the source of shared-keys, then TLS-SRP is a superior choice because it is not subject to dictionary attacks.
When certificate-based security is used in RELOAD, any given Resource-ID/kind-id pair (a slot) is bound to some small set of certificates. In order to write data in a slot, the writer must prove possession of the private key for one of those certificates. Moreover, all data is stored signed by the certificate which authorized its storage. This set of rules makes questions of authorization and data integrity - which have historically been thorny for DHTs - relatively simple. When shared-secret security is used, then all peers trust all other peers, provided that they have demonstrated that they have the credentials to join the overlay at all. The following text therefore applies only to certificate-based security.
When a client wants to store some value in a slot, it first digitally signs the value with its own private key. It then sends a STORE request that contains both the value and the signature towards the storing peer (which is defined by the Unhashed-ID construction algorithm for that particular kind of value). When the storing peer receives the request, it must determine whether the storing client is authorized to store in this slot. In order to do so, it executes the Unhashed-ID construction algorithm for the specified kind based on the user's certificate information. It then computes the Resource-ID from the Unhashed-ID and verifies that it matches the slot which the user is requesting to write to. If it does, the user is authorized to write to this slot, pending quota checks as described in the next section. For example, consider the certificate with the following properties:
If Alice wishes to STORE a value of the "SIP Location" kind, the Unhashed-ID will be the SIP AOR "sip:alice@dht.example.com". The Resource-ID will be determined by hashing the Unhashed-ID. When a peer receives a request to store a record at Resource-ID X, it takes the signing certificate and recomputes the Unhashed-ID, in this case "alice@dht.example.com". If H("alice@dht.example.com")=X then the STORE is authorized. Otherwise it is not. Note that the Unhashed-ID construction algorithm may be different for other kinds.
Being a peer in a DHT Instance carries with it the responsibility to store data for a given region of the DHT Instance. However, if clients were allowed to store unlimited amounts of data, this would create unacceptable burdens on peers, as well as enabling trivial denial of service attacks. RELOAD addresses this issue by requiring each usage to define maximum sizes for each kind of stored data. Attempts to store values exceeding this size MUST be rejected (if peers are inconsistent about this, then strange artifacts will happen when the zone of responsibility shifts and a different peer becomes responsible for overlarge data). Because each slot is bound to a small set of certificates, these size restrictions also create a distributed quota mechanism, with the quotas administered by the central enrollment server. Allowing different kinds of data to have different size restrictions allows new usages the flexibility to define limits that fit their needs without requiring all usages to have expansive limits.
Because each stored value is signed, it is trivial for any retrieving peer to verify the integrity of the stored value. Some more care needs to be taken to prevent version rollback attacks. Rollback attacks on storage are prevented by the use of store times and lifetime values in each store. A lifetime represents the latest time at which the data is valid and thus limits (though does not completely prevent) the ability of the storing node to perform a rollback attack on retrievers. In order to prevent a rollback attack at the time of the STORE request, we require that storage times be monotonically increasing. Storing peers MUST reject STORE requests with storage times smaller than or equal to those they are currently storing. In addition, a fetching node which receives a data value with a storage time older than the result of the previous fetch knows a rollback has occurred.
The mechanisms described here provide a high degree of security, but some attacks remain possible. Most simply, it is possible for storing nodes to refuse to store a value (i.e., reject any request). In addition, a storing node can deny knowledge of values which it previously accepted. To some extent these attacks can be ameliorated by attempting to store to/retrieve from replicas, but a retrieving client does not know whether it should try this or not, since there is a cost to doing so. Although the certificate-based authentication scheme prevents a single peer from being able to forge data owned by other peers. Furthermore, although a subversive peer can refuse to return data resources for which it is responsible it cannot return forged data because it cannot provide authentication for such registrations. Therefore parallel searches for redundant registrations can mitigate most of the affects of a compromised peer. The ultimate reliability of such an overlay is a statistical question based on the replication factor and the percentage of compromised peers. In addition, when a kind is is multivalued (e.g., an array data model), the storing node can return only some subset of the values, thus biasing its responses. This can be countered by using single values rather than sets, but that makes coordination between multiple storing agents much more difficult. This is a tradeoff that must be made when designing any usage.
Because the storage security system guarantees (within limits) the integrity of the stored data, routing security focuses on stopping the attacker from performing a DOS attack on the system by misrouting requests in the DHT. There are a few obvious observations to make about this. First, it is easy to ensure that an attacker is at least a valid peer in the DHT Instance. Second, this is a DOS attack only. Third, if a large percentage of the peers on the DHT Instance are controlled by the attacker, it is probably impossible to perfectly secure against this.
In general, attacks on DHT routing are mounted by the attacker arranging to route traffic through or two nodes it controls. In the Eclipse attack the attacker tampers with messages to and from nodes for which it is on-path with respect to a given victim node. This allows it to pretend to be all the nodes that are reachable through it. In the Sybil attack , the attacker registers a large number of nodes and is therefore able to capture a large amount of the traffic through the DHT. Both the Eclipse and Sybil attacks require the attacker to be able to exercise control over her peer IDs. The Sybil attack requires the creation of a large number of peers. The Eclipse attack requires that the attacker be able to impersonate specific peers. In both cases, these attacks are limited by the use of centralized, certificate-based admission control.
Admission to an RELOAD DHT Instance is controlled by requiring that each peer have a certificate containing its peer ID. The requirement to have a certificate is enforced by using certificate-based mutual authentication on each connection. Thus, whenever a peer connects to another peer, each side automatically checks that the other has a suitable certificate. These peer IDs are randomly assigned by the central enrollment server. This has two benefits: It allows the enrollment server to limit the number of peer IDs issued to any individual user. It prevents the attacker from choosing specific peer IDs. The first property allows protection against Sybil attacks (provided the enrollment server uses strict rate limiting policies). The second property deters but does not completely prevent Eclipse attacks. Because an Eclipse attacker must impersonate peers on the other side of the attacker, he must have a certificate for suitable peer IDs, which requires him to repeatedly query the enrollment server for new certificates which only will match by chance. From the attacker's perspective, the difficulty is that if he only has a small number of certificates the region of the DHT Instance he is impersonating appears to be very sparsely populated by comparison to the victim's local region.
In general, whenever a peer engages in DHT activity that might affect the routing table it must establish its identity. This happens in two ways. First, whenever a peer establishes a direct connection to another peer it authenticates via certificate-based mutual authentication. All messages between peers are sent over this protected channel and therefore the peers can verify the data origin of the last hop peer for requests and responses without further cryptography. In some situations, however, it is desirable to be able to establish the identity of a peer with whom one is not directly connected. The most natural case is when a peer UPDATEs its state. At this point, other peers may need to update their view of the DHT structure, but they need to verify that the UPDATE message came from the actual peer rather than from an attacker. To prevent this, all DHT routing messages are signed by the peer that generated them. [TODO: this allows for replay attacks on requests. There are two basic defenses here. The first is global clocks and loose anti-replay. The second is to refuse to take any action unless you verify the data with the relevant node. This issue is undecided.] [TODO: I think we are probably going to end up with generic signatures or at least optional signatures on all DHT messages.]
The goal here is to stop an attacker from knowing who is signaling what to whom. An attacker being able to observe the activities of a specific individual is unlikely given the randomization of IDs and routing based on the present peers discussed above. Furthermore, because messages can be routed using only the header information, the actual body of the RELOAD message can be encrypted during transmission. There are two lines of defense here. The first is the use of TLS or DTLS for each communications link between peers. This provides protection against attackers who are not members of the overlay. The second line of defense, if certificate-based security is used, is to digitally sign each message. This prevents adversarial peers from modifying messages in flight, even if they are on the routing path.
The routing security mechanisms in RELOAD are designed to contain rather than eliminate attacks on routing. It is still possible for an attacker to mount a variety of attacks. In particular, if an attacker is able to take up a position on the DHT routing between A and B it can make it appear as if B does not exist or is disconnected. It can also advertise false network metrics in attempt to reroute traffic. However, these are primarily DoS attacks. The certificate-based security scheme secures the namespace, but if an individual peer is compromised or if an attacker obtains a certificate from the CA, then a number of subversive peers can still appear in the overlay. While these peers cannot falsify responses to resource queries, they can respond with error messages, effecting a DoS attack on the resource registration. They can also subvert routing to other compromised peers. To defend against such attacks, a resource search must still consist of parallel searches for replicated registrations.
Because SIP includes a forking capability (the ability to retarget to multiple recipients), fork bombs are a potential DoS concern. However, in the SIP usage of RELOAD, fork bombs are a much lower concern because the calling party is involved in each retargeting event and can therefore directly measure the number of forks and throttle at some reasonable number.
Another potential DoS attack is for the owner of an attractive number to retarget all calls to some victim. This attack is difficult to ameliorate without requiring the target of a SIP registration to authorize all stores. The overhead of that requirement would be excessive and in addition there are good use cases for retargeting to a peer without there explicit cooperation.
All RELOAD SIP registration data is public. Methods of providing location and identity privacy are still being studied.
This section contains the new code points registered by this document. The IANA policies are TBD.
IANA SHALL create/(has created) a "RELOAD Overlay Algorithm Type" Registry. Entries in this registry are strings denoting the names of DHT algorithms. The registration policy for this registry is TBD. The initial contents of this registry are: The algorithm defined in of this document.
IANA SHALL create/(has created) a "RELOAD Data Kind-Id" Registry. Entries in this registry are 32-bit integers denoting data kinds, as described in [XREF]. The registration policy for this registry is TBD. The initial contents of this registry are: Kind Kind-Id SIP-REGISTRATION 1 TURN_SERVICE 2 CERTIFICATE 3 SOFTWARE_VERSION 4 UPTIME 5 AS_NUMBER 6 CPU_UTILIZATION 7 DATA_STORED 8 MESSAGES_SENT 9 INSTANCES_STORED 10 ROUTING_TABLE_SIZE 11 NEIGHBOR_TABLE_SIZE 12
IANA SHALL create/(has created) a "RELOAD Data Model" Registry. Entries in this registry are 8-bit integers denoting data models, as described in [XREF]. The registration policy for this registry is TBD. Data Model Identifier SINGLE_VALUE 1 ARRAY 2 DICTIONARY 3
IANA SHALL create/(has created) a "RELOAD Message Code" Registry. Entries in this registry are 16-bit integers denoting method codes as described in [XREF] The registration policy for this registry is TBD. The initial contents of this registry are: Message Code Name Code Value RESERVED 0 PING_Q 1 PING_A 2 CONNECT_Q 3 CONNECT_A 4 TUNNEL_Q 5 TUNNEL_A 6 STORE_Q 7 STORE_A 8 FETCH_Q 9 FETCH_A 10 REMOVE_Q 11 REMOVE_A 12 FIND_Q 13 FIND_A 14 JOIN_Q 15 JOIN_A 16 LEAVE_Q 17 LEAVE_A 18 UPDATE_Q 19 UPDATE_A 20 ROUTE_QUERY_Q 21 ROUTE_QUERY_A 22 RESERVED 0x8000..0xfffe ERROR 0xffff
[[TODO - add IANA registration for p2p_enroll SRV and p2p_menroll]]
IANA SHALL create/(has created) a "RELOAD Error Code" Registry. Entries in this registry are 16-bit integers denoting error codes. [[TODO: Complete this once we decide on error code strategy.
This draft is a merge of the "REsource LOcation And Discovery (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) draft by Salman A. Baset, Henning Schulzrinne, and Marcin Matuszewski. Thanks to the many people who contributed including: Michael Chen, TODO - fill in.
Key words for use in RFCs to Indicate Requirement Levels Harvard University
1350 Mass. Ave. Cambridge MA 02138 - +1 617 495 3864 sob@harvard.edu
General keyword
Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols This document describes a protocol for Network Address Translator (NAT) traversal for multimedia sessions established with the offer/ answer model. This protocol is called Interactive Connectivity Establishment (ICE). ICE makes use of the Session Traversal Utilities for NAT (STUN) protocol, applying its binding discovery and relay usages, in addition to defining a new usage for checking connectivity between peers. ICE can be used by any protocol utilizing the offer/answer model, such as the Session Initiation Protocol (SIP). Session Traversal Utilities for (NAT) (STUN) Session Traversal Utilities for NAT (STUN) is a lightweight protocol that serves as a tool for application protocols in dealing with NAT traversal. It allows a client to determine the IP address and port allocated to them by a NAT and to keep NAT bindings open. It can also serve as a check for connectivity between a client and a server in the presence of NAT, and for the client to detect failure of the server. STUN works with many existing NATs, and does not require any special behavior from them. As a result, it allows a wide variety of applications to work through existing NAT infrastructure. Obtaining Relay Addresses from Simple Traversal Underneath NAT (STUN) This specification defines a usage of the Simple Traversal Underneath NAT (STUN) Protocol for asking the STUN server to relay packets towards a client. This usage is useful for elements behind NATs whose mapping behavior is address and port dependent. The extension purposefully restricts the ways in which the relayed address can be used. In particular, it prevents users from running general purpose servers from ports obtained from the STUN server. Certificate Management over CMS (CMC) Transport Protocols This document defines a number of transport mechanisms that are used to move CMC (Certificate Management over CMS (Cryptographic Message Syntax)) messages. The transport mechanisms described in this document are: HTTP, file, mail and TCP. Certificate Management Messages over CMS This document defines the base syntax for CMC, a Certificate Management protocol using CMS (Cryptographic Message Syntax). This protocol addresses two immediate needs within the Internet PKI community: 1. The need for an interface to public key certification products and services based on CMS and PKCS #10 (Public Key Cryptography 2. The need in S/MIME (Secure MIME) for a certificate enrollment protocol for DSA-signed certificates with Diffie-Hellman public keys. CMC also requires the use of the transport document and the requirements usage document along with this document for a full definition. Pre-Shared Key Ciphersuites for Transport Layer Security (TLS) This document specifies three sets of new ciphersuites for the Transport Layer Security (TLS) protocol to support authentication based on pre-shared keys (PSKs). These pre-shared keys are symmetric keys, shared in advance among the communicating parties. The first set of ciphersuites uses only symmetric key operations for authentication. The second set uses a Diffie-Hellman exchange authenticated with a pre-shared key, and the third set combines public key authentication of the server with pre-shared key authentication of the client. [STANDARDS TRACK] Using SRP for TLS Authentication This memo presents a technique for using the Secure Remote Password protocol as an authentication method for the Transport Layer Security protocol. TCP Candidates with Interactive Connectivity Establishment (ICE Interactive Connectivity Establishment (ICE) defines a mechanism for NAT traversal for multimedia communication protocols based on the offer/answer model of session negotiation. ICE works by providing a set of candidate transport addresses for each media stream, which are then validated with peer-to-peer connectivity checks based on Simple Traversal of UDP over NAT (STUN). ICE provides a general framework for describing alternates, but only defines UDP-based transport protocols. This specification extends ICE to TCP-based media, including the ability to offer a mix of TCP and UDP-based candidates for a single stream. SIP: Session Initiation Protocol Session Initiation Protocol (SIP): Locating SIP Servers The Session Initiation Protocol (SIP) uses DNS procedures to allow a client to resolve a SIP Uniform Resource Identifier (URI) into the IP address, port, and transport protocol of the next hop to contact. It also uses DNS to allow a server to send a response to a backup client if the primary client has failed. This document describes those DNS procedures in detail. [STANDARDS TRACK] Datagram Transport Layer Security This document specifies Version 1.0 of the Datagram Transport Layer Security (DTLS) protocol. The DTLS protocol provides communications privacy for datagram protocols. The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery. The DTLS protocol is based on the Transport Layer Security (TLS) protocol and provides equivalent security guarantees. Datagram semantics of the underlying transport are preserved by the DTLS protocol. [STANDARDS TRACK] TCP Friendly Rate Control (TFRC): The Small-Packet (SP) Variant This document proposes a mechanism for further experimentation, but not for widespread deployment at this time in the global Internet.</t><t> TCP-Friendly Rate Control (TFRC) is a congestion control mechanism for unicast flows operating in a best-effort Internet environment (RFC 3448). TFRC was intended for applications that use a fixed packet size, and was designed to be reasonably fair when competing for bandwidth with TCP connections using the same packet size. This document proposes TFRC-SP, a Small-Packet (SP) variant of TFRC, that is designed for applications that send small packets. The design goal for TFRC-SP is to achieve the same bandwidth in bps (bits per second) as a TCP flow using packets of up to 1500 bytes. TFRC-SP enforces a minimum interval of 10 ms between data packets to prevent a single flow from sending small packets arbitrarily frequently.</t><t> Flows using TFRC-SP compete reasonably fairly with large-packet TCP and TFRC flows in environments where large-packet flows and small-packet flows experience similar packet drop rates. However, in environments where small-packet flows experience lower packet drop rates than large-packet flows (e.g., with Drop-Tail queues in units of bytes), TFRC-SP can receive considerably more than its share of the bandwidth. This memo defines an Experimental Protocol for the Internet community.
NAT Behavioral Requirements for TCP This document defines a set of requirements for NATs that handle TCP that would allow many applications, such as peer-to-peer applications and on-line games, to work consistently. Developing NATs that meet this set of requirements will greatly increase the likelihood that these applications will function properly. Concepts and Terminology for Peer to Peer SIP This document defines concepts and terminology for use of the Session Initiation Protocol in a peer-to-peer environment where the traditional proxy-registrar and message routing functions are replaced by a distributed mechanism that might be implemented using a distributed hash table or other distributed data mechanism with similar external properties. This document includes a high-level view of the functional relationships between the network elements defined herein, a conceptual model of operations, and an outline of the related open problems being addressed by the P2PSIP working group. As this document matures, it is expected to define the general framework for P2PSIP. TCP-Based Media Transport in the Session Description Protocol (SDP) This document describes how to express media transport over TCP using the Session Description Protocol (SDP). It defines the SDP 'TCP' protocol identifier, the SDP 'setup' attribute, which describes the connection setup procedure, and the SDP 'connection' attribute, which handles connection reestablishment. [STANDARDS TRACK] Connection-Oriented Media Transport over the Transport Layer Security (TLS) Protocol in the Session Description Protocol (SDP) This document specifies how to establish secure connection-oriented media transport sessions over the Transport Layer Security (TLS) protocol using the Session Description Protocol (SDP). It defines a new SDP protocol identifier, 'TCP/TLS'. It also defines the syntax and semantics for an SDP 'fingerprint' attribute that identifies the certificate that will be presented for the TLS session. This mechanism allows media transport over TLS connections to be established securely, so long as the integrity of session descriptions is assured.</t><t> This document extends and updates RFC 4145. [STANDARDS TRACK] HTTP Authentication: Basic and Digest Access Authentication Northwestern University, Department of Mathematics
Northwestern University Evanston IL 60208-2730 USA john@math.nwu.edu
Verisign Inc.
301 Edgewater Place Suite 210 Wakefield MA 01880 USA pbaker@verisign.com
AbiSource, Inc.
6 Dunlap Court Savoy IL 61874 USA jeff@AbiSource.com
Agranat Systems, Inc.
5 Clocktower Place Suite 400 Maynard MA 01754 USA lawrence@agranat.com
Microsoft Corporation
1 Microsoft Way Redmond WA 98052 USA paulle@microsoft.com
"HTTP/1.0", includes the specification for a Basic Access Authentication scheme. This scheme is not considered to be a secure method of user authentication (unless used in conjunction with some external secure system such as SSL ), as the user name and password are passed over the network as cleartext. This document also provides the specification for HTTP's authentication framework, the original Basic authentication scheme and a scheme based on cryptographic hashes, referred to as "Digest Access Authentication". It is therefore also intended to serve as a replacement for RFC 2069 . Some optional elements specified by RFC 2069 have been removed from this specification due to problems found since its publication; other new elements have been added for compatibility, those new elements have been made optional, but are strongly recommended. Like Basic, Digest access authentication verifies that both parties to a communication know a shared secret (a password); unlike Basic, this verification can be done without sending the password in the clear, which is Basic's biggest weakness. As with most other authentication protocols, the greatest sources of risks are usually found not in the core protocol itself but in policies and procedures surrounding its use.
HTTP Over TLS This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet. This memo provides information for the Internet community. Randomness Requirements for Security Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts. However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities. The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.</t><t> Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult. This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities. It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements. Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile This memo profiles the X.509 v3 certificate and X.509 v2 Certificate Revocation List (CRL) for use in the Internet. [STANDARDS TRACK] The Sybil Attack Microsoft Research Eclipse Attacks on Overlay Networks: Threats and Defenses Multicast DNS DNS-Based Service Discovery This document describes a convention for naming and structuring DNS resource records. Given a type of service that a client is looking for, and a domain in which the client is looking for that service, this convention allows clients to discover a list of named instances of that desired service, using only standard DNS queries. In short, this is referred to as DNS-based Service Discovery, or DNS-SD. Bootstrap Mechanisms for P2PSIP This document describes mechanisms that a peer can use to locate and establish a Peer Protocol connection to an admitting peer in order to join an overlay network. In the first mechanism, the joining peer uses multicast to locate a bootstrap peer; in the second, the node uses one or more bootstrap servers to locate a bootstrap peer; in both cases, the bootstrap peer then proxies the request by the joining peer on to the admitting peer. Each mechanism has its advantages and disadvantages, and a node can utilize both. P2PSIP bootstrapping using DNS-SD This document describes a DNS-based bootstrap mechanism to discover the initial peer or peers needed to join a P2PSIP Overlay. The document specifies the use of DNS Service Discovery (DNS-SD) and the format of the required resource records to support the discovery of P2PSIP peers. This mechanism can be applied in scenarios with DNS servers or combined with multicast DNS to fulfill different proposed P2PSIP use cases. HIP BONE: Host Identity Protocol (HIP) Based Overlay Networking Environment This document specifies a framework to build HIP (Host Identity Protocol)-based overlay networks. This framework uses HIP to perform connection management. Other functions, such as data storage and retrieval or overlay maintenance, are implemented using protocols other than HIP. These protocols are loosely referred to as peer protocols. P2PSIP Clients This document describes why and when some devices would better be a Client rather than a Peer. The purpose of this document is to facilitate the discussion and understanding about the Client node type. Network Address Translation (NAT) Behavioral Requirements for Unicast UDP This document defines basic terminology for describing different types of Network Address Translation (NAT) behavior when handling Unicast UDP and also defines a set of requirements that would allow many applications, such as multimedia communications or online gaming, to work consistently. Developing NATs that meet this set of requirements will greatly increase the likelihood that these applications will function properly. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements. Service Extensible P2P Peer Protocol This document describes the Service Extensible Protocol (SEP), which is the peer protocol spoken between P2PSIP Overlay peers to share information and organize the P2PSIP Overlay Network. SEP uses a flexible forwarding mechanism to avoid congestion in the Overlay. It also proposes a general service discovery method and a built-in NATtraversal mechanism. By using these methods, SEP tries to improve the success rate and reduce the latency of the transaction.