idnits 2.17.1 draft-ietf-homenet-dncp-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 217 has weird spacing: '...ntifier an o...' == Line 253 has weird spacing: '...on Time the (...' == Line 275 has weird spacing: '...e trust the ...' == Line 279 has weird spacing: '...y graph the...' == Line 283 has weird spacing: '...ionally a pe...' == (1 more instance...) -- The document date (October 14, 2015) is 3115 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 6234 ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 3315 (Obsoleted by RFC 8415) -- Obsolete informational reference (is this intentional?): RFC 6347 (Obsoleted by RFC 9147) -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) Summary: 2 errors (**), 0 flaws (~~), 7 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Homenet Working Group M. Stenberg 3 Internet-Draft S. Barth 4 Intended status: Standards Track Independent 5 Expires: April 16, 2016 October 14, 2015 7 Distributed Node Consensus Protocol 8 draft-ietf-homenet-dncp-11 10 Abstract 12 This document describes the Distributed Node Consensus Protocol 13 (DNCP), a generic state synchronization protocol that uses the 14 Trickle algorithm and hash trees. DNCP is an abstract protocol, and 15 must be combined with a specific profile to make a complete 16 implementable protocol. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at http://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on April 16, 2016. 35 Copyright Notice 37 Copyright (c) 2015 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (http://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 53 1.1. Applicability . . . . . . . . . . . . . . . . . . . . . . 3 54 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 55 2.1. Requirements Language . . . . . . . . . . . . . . . . . . 7 56 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 7 57 4. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 8 58 4.1. Hash Tree . . . . . . . . . . . . . . . . . . . . . . . . 8 59 4.1.1. Calculating network state and node data hashes . . . 8 60 4.1.2. Updating network state and node data hashes . . . . . 9 61 4.2. Data Transport . . . . . . . . . . . . . . . . . . . . . 9 62 4.3. Trickle-Driven Status Updates . . . . . . . . . . . . . . 10 63 4.4. Processing of Received TLVs . . . . . . . . . . . . . . . 11 64 4.5. Discovering, Adding and Removing Peers . . . . . . . . . 14 65 4.6. Data Liveliness Validation . . . . . . . . . . . . . . . 15 66 5. Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 16 67 6. Optional Extensions . . . . . . . . . . . . . . . . . . . . . 17 68 6.1. Keep-Alives . . . . . . . . . . . . . . . . . . . . . . . 18 69 6.1.1. Data Model Additions . . . . . . . . . . . . . . . . 18 70 6.1.2. Per-Endpoint Periodic Keep-Alives . . . . . . . . . . 19 71 6.1.3. Per-Peer Periodic Keep-Alives . . . . . . . . . . . . 19 72 6.1.4. Received TLV Processing Additions . . . . . . . . . . 19 73 6.1.5. Peer Removal . . . . . . . . . . . . . . . . . . . . 19 74 6.2. Support For Dense Multicast-Enabled Links . . . . . . . . 20 75 7. Type-Length-Value Objects . . . . . . . . . . . . . . . . . . 21 76 7.1. Request TLVs . . . . . . . . . . . . . . . . . . . . . . 22 77 7.1.1. Request Network State TLV . . . . . . . . . . . . . . 22 78 7.1.2. Request Node State TLV . . . . . . . . . . . . . . . 22 79 7.2. Data TLVs . . . . . . . . . . . . . . . . . . . . . . . . 22 80 7.2.1. Node Endpoint TLV . . . . . . . . . . . . . . . . . . 22 81 7.2.2. Network State TLV . . . . . . . . . . . . . . . . . . 23 82 7.2.3. Node State TLV . . . . . . . . . . . . . . . . . . . 23 83 7.3. Data TLVs within Node State TLV . . . . . . . . . . . . . 24 84 7.3.1. Peer TLV . . . . . . . . . . . . . . . . . . . . . . 24 85 7.3.2. Keep-Alive Interval TLV . . . . . . . . . . . . . . . 25 86 8. Security and Trust Management . . . . . . . . . . . . . . . . 25 87 8.1. Pre-Shared Key Based Trust Method . . . . . . . . . . . . 25 88 8.2. PKI Based Trust Method . . . . . . . . . . . . . . . . . 26 89 8.3. Certificate Based Trust Consensus Method . . . . . . . . 26 90 8.3.1. Trust Verdicts . . . . . . . . . . . . . . . . . . . 26 91 8.3.2. Trust Cache . . . . . . . . . . . . . . . . . . . . . 27 92 8.3.3. Announcement of Verdicts . . . . . . . . . . . . . . 28 93 8.3.4. Bootstrap Ceremonies . . . . . . . . . . . . . . . . 29 94 9. DNCP Profile-Specific Definitions . . . . . . . . . . . . . . 30 95 10. Security Considerations . . . . . . . . . . . . . . . . . . . 31 96 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 97 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 33 98 12.1. Normative references . . . . . . . . . . . . . . . . . . 33 99 12.2. Informative references . . . . . . . . . . . . . . . . . 33 100 Appendix A. Alternative Modes of Operation . . . . . . . . . . . 34 101 A.1. Read-only Operation . . . . . . . . . . . . . . . . . . . 34 102 A.2. Forwarding Operation . . . . . . . . . . . . . . . . . . 34 103 Appendix B. DNCP Profile Additional Guidance . . . . . . . . . . 34 104 B.1. Unicast Transport - UDP or TCP? . . . . . . . . . . . . . 34 105 B.2. (Optional) Multicast Transport . . . . . . . . . . . . . 35 106 B.3. (Optional) Transport Security . . . . . . . . . . . . . . 35 107 Appendix C. Example Profile . . . . . . . . . . . . . . . . . . 36 108 Appendix D. Some Questions and Answers [RFC Editor: please 109 remove] . . . . . . . . . . . . . . . . . . . . . . 37 110 Appendix E. Changelog [RFC Editor: please remove] . . . . . . . 37 111 Appendix F. Draft Source [RFC Editor: please remove] . . . . . . 39 112 Appendix G. Acknowledgements . . . . . . . . . . . . . . . . . . 39 113 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 39 115 1. Introduction 117 DNCP is designed to provide a way for each participating node to 118 publish a small set of TLV (Type-Length-Value) tuples (at most 64 119 KB), and to provide a shared and common view about the data published 120 by every currently bidirectionally reachable DNCP node in a network. 122 For state synchronization a hash tree is used. It is formed by first 123 calculating a hash for the dataset published by each node, called 124 node data, and then calculating another hash over those node data 125 hashes. The single resulting hash, called network state hash, is 126 transmitted using the Trickle algorithm [RFC6206] to ensure that all 127 nodes share the same view of the current state of the published data 128 within the network. The use of Trickle with only short network state 129 hashes sent infrequently (in steady state, once the maximum Trickle 130 interval per link or unicast connection has been reached) makes DNCP 131 very thrifty when updates happen rarely. 133 For maintaining liveliness of the topology and the data within it, a 134 combination of Trickled network state, keep-alives, and "other" means 135 of ensuring reachability are used. The core idea is that if every 136 node ensures its peers are present, transitively, the whole network 137 state also stays up-to-date. 139 1.1. Applicability 141 DNCP is useful for cases like autonomous bootstrapping, discovery and 142 negotiation of embedded network devices like routers. Furthermore it 143 can be used as a basis to run distributed algorithms like 144 [I-D.ietf-homenet-prefix-assignment] or usecases as described in 145 Appendix C. The topology of the devices is not limited and 146 automatically discovered. If globally scoped addresses are used, 147 DNCP peers do not necessarily need to be on the same link. 148 Autonomous discovery features are usually used in local network 149 scenario however - with security enabled - DNCP can also be used over 150 unsecured public networks. Network size is restricted merely by the 151 capabilities of the devices, i.e., each DNCP node needs to be able to 152 store the entirety of the data published by all nodes. 154 DNCP is most suitable for data that changes only infrequently to gain 155 the maximum benefit from using Trickle. As the network of nodes 156 grows, or the frequency of data changes per node increases, Trickle 157 is eventually used less and less and the benefit of using DNCP 158 diminishes. In these cases Trickle just provides extra complexity 159 within the specification and little added value. 161 The suitability of DNCP for a particular application can roughly be 162 evaluated by considering the expected average network-wide state 163 change interval A_NC_I; it is computed by dividing the mean interval 164 at which a node originates a new TLV set by the number of 165 participating nodes. If keep-alives are used, A_NC_I is the minimum 166 of the computed A_NC_I and the keep-alive interval. If A_NC_I is 167 less than the (application-specific) Trickle minimum interval, DNCP 168 is most likely unsuitable for the application as Trickle will not be 169 utilized most of the time. 171 If constant rapid state changes are needed, the preferable choice is 172 to use an additional point-to-point channel whose address or locator 173 is published using DNCP. Nevertheless, if doing so does not raise 174 A_NC_I above the (sensibly chosen) Trickle interval parameters for a 175 particular application, using DNCP is probably not suitable for the 176 application. 178 Another consideration is the size of the published TLV set by a node 179 compared to the size of deltas in the TLV set. If the TLV set 180 published by a node is very large, and has frequent small changes, 181 DNCP as currently specified in this specification may be unsuitable 182 as it lacks a delta synchronization scheme to keep implementation 183 simple. 185 DNCP can be used in networks where only unicast transport is 186 available. While DNCP uses the least amount of bandwidth when 187 multicast is utilized, even in pure unicast mode, the use of Trickle 188 (ideally with k < 2) results in a protocol with an exponential 189 backoff timer and fewer transmissions than a simpler protocol not 190 using Trickle. 192 2. Terminology 194 DNCP profile the values for the set of parameters, given in 195 Section 9. They are prefixed with DNCP_ in this 196 document. The profile also specifies the set of 197 optional DNCP extensions to be used. For a simple 198 example DNCP profile, see Appendix C. 200 DNCP-based a protocol which provides a DNCP profile, according 201 protocol to Section 9, and zero or more TLV assignments from 202 the per-DNCP profile TLV registry as well as their 203 processing rules. 205 DNCP node a single node which runs a DNCP-based protocol. 207 Link a link-layer media over which directly connected 208 nodes can communicate. 210 DNCP network a set of DNCP nodes running DNCP-based protocol(s) 211 with matching DNCP profile(s). The set consists of 212 nodes that have discovered each other using the 213 transport method defined in the DNCP profile, via 214 multicast on local links, and / or by using unicast 215 communication. 217 Node identifier an opaque fixed-length identifier consisting of 218 DNCP_NODE_IDENTIFIER_LENGTH bytes which uniquely 219 identifies a DNCP node within a DNCP network. 221 Interface a node's attachment to a particular link. 223 Address an identifier used as source or destination of a 224 DNCP message flow, e.g., a tuple (IPv6 address, UDP 225 port) for an IPv6 UDP transport. 227 Endpoint a locally configured termination point for 228 (potential or established) DNCP message flows. An 229 endpoint is the source and destination for separate 230 unicast message flows to individual nodes and 231 optionally for multicast messages to all thereby 232 reachable nodes (e.g., for node discovery). 233 Endpoints are usually in one of the transport modes 234 specified in Section 4.2. 236 Endpoint a 32-bit opaque and locally unique value, which 237 identifier identifies a particular endpoint of a particular 238 DNCP node. The value 0 is reserved for DNCP and 239 DNCP-based protocol purposes and not used to 240 identify an actual endpoint. This definition is in 241 sync with the interface index definition in 242 [RFC3493], as the non-zero small positive integers 243 should comfortably fit within 32 bits. 245 Peer another DNCP node with which a DNCP node 246 communicates using a particular local and remote 247 endpoint pair. 249 Node data a set of TLVs published and owned by a node in the 250 DNCP network. Other nodes pass it along as-is, even 251 if they cannot fully interpret it. 253 Origination Time the (estimated) time when the node data set with 254 the current sequence number was published. 256 Node state a set of metadata attributes for node data. It 257 includes a sequence number for versioning, a hash 258 value for comparing equality of stored node data, 259 and a timestamp indicating the time passed since 260 its last publication (i.e., since the origination 261 time). The hash function and the length of the hash 262 value are defined in the DNCP profile. 264 Network state a hash value which represents the current state of 265 hash the network. The hash function and the length of 266 the hash value are defined in the DNCP profile. 267 Whenever a node is added, removed or updates its 268 published node data this hash value changes as 269 well. For calculation, please see Section 4.1. 271 Trust verdict a statement about the trustworthiness of a 272 certificate announced by a node participating in 273 the certificate based trust consensus mechanism. 275 Effective trust the trust verdict with the highest priority within 276 verdict the set of trust verdicts announced for the 277 certificate in the DNCP network. 279 Topology graph the undirected graph of DNCP nodes produced by 280 retaining only bidirectional peer relationships 281 between nodes. 283 Bidirectionally a peer is locally unidirectionally reachable if a 284 reachable consistent multicast or any unicast DNCP message 285 has been received by the local node (see Section 286 4.5). If said peer in return also considers the 287 local node unidirectionally reachable, then 288 bidirectionally reachability is established. As 289 this process is based on publishing peer 290 relationships and evaluating the resulting topology 291 graph as described in Section 4.6, this information 292 is available to the whole DNCP network. 294 Trickle Instance a distinct Trickle [RFC6206] algorithm state kept 295 by a node (Section 5) and related to an endpoint or 296 a particular (peer, endpoint) tuple with Trickle 297 variables I, t and c. See Section 4.3. 299 2.1. Requirements Language 301 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 302 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 303 "OPTIONAL" in this document are to be interpreted as described in RFC 304 2119 [RFC2119]. 306 3. Overview 308 DNCP operates primarily using unicast exchanges between nodes, and 309 may use multicast for Trickle-based shared state dissemination and 310 topology discovery. If used in pure unicast mode with unreliable 311 transport, Trickle is also used between peers. 313 DNCP is based on exchanging TLVs (Section 7) and defines a set of 314 mandatory and optional ones for its operation. They are categorized 315 into TLVs for requesting information (Section 7.1), transmitting data 316 (Section 7.2) and being published as data (Section 7.3). DNCP based 317 protocols usually specify additional ones to extend the capabilities. 319 DNCP discovers the topology of the nodes in the DNCP network and 320 maintains the liveliness of published node data by ensuring that the 321 publishing node is bidirectionally reachable. New potential peers 322 can be discovered autonomously on multicast-enabled links, their 323 addresses may be manually configured or they may be found by some 324 other means defined in the particular DNCP profile. The DNCP profile 325 may specify, for example, a well-known anycast address or 326 provisioning the remote address to contact via some other protocol 327 such as DHCPv6 [RFC3315]. 329 A hash tree of height 1, rooted in itself, is maintained by each node 330 to represent the state of all currently reachable nodes (see 331 Section 4.1) and the Trickle algorithm is used to trigger 332 synchronization (see Section 4.3). The need to check peer nodes for 333 state changes is thereby determined by comparing the current root of 334 their respective hash trees, i.e., their individually calculated 335 network state hashes. 337 Before joining a DNCP network, a node starts with a hash tree that 338 has only one leaf if the node publishes some TLVs, and no leaves 339 otherwise. It then announces the network state hash calculated from 340 the hash tree by means of the Trickle algorithm on all its configured 341 endpoints. 343 When an update is detected by a node (e.g., by receiving a different 344 network state hash from a peer) the originator of the event is 345 requested to provide a list of the state of all nodes, i.e., all the 346 information it uses to calculate its own hash tree. The node uses 347 the list to determine whether its own information is outdated and - 348 if necessary - requests the actual node data that has changed. 350 Whenever a node's local copy of any node data and its hash tree are 351 updated (e.g., due to its own or another node's node state changing 352 or due to a peer being added or removed) its Trickle instances are 353 reset which eventually causes any update to be propagated to all of 354 its peers. 356 4. Operation 358 4.1. Hash Tree 360 Each DNCP node maintains an arbitrary width hash tree of height 1. 361 The root of the tree represents the overall network state hash and is 362 used to determine whether the view of the network of two or more 363 nodes is consistent and shared. Each leaf represents one 364 bidirectionally reachable DNCP node. Every time a node is added or 365 removed from the topology graph (Section 4.6) it is likewise added or 366 removed as a leaf. At any time the leaves of the tree are ordered in 367 ascending order of the node identifiers of the nodes they represent. 369 4.1.1. Calculating network state and node data hashes 371 The network state hash and the node data hashes are calculated using 372 the hash function defined in the DNCP profile (Section 9) and 373 truncated to the number of bits specified therein. 375 Individual node data hashes are calculated by applying the function 376 and truncation on the respective node's node data as published in the 377 Node State TLV. Such node data sets are always ordered as defined in 378 Section 7.2.3. 380 The network state hash is calculated by applying the function and 381 truncation on the concatenated network state. This state is formed 382 by first concatenating each node's sequence number (in network byte 383 order) with its node data hash to form a per-node datum for each 384 node. These per-node data are then concatenated in ascending order 385 of the respective node's node identifier, i.e., in the order that the 386 nodes appear in the hash tree. 388 4.1.2. Updating network state and node data hashes 390 The network state hash and the node data hashes are updated on-demand 391 and whenever any locally stored per-node state changes. This 392 includes local unidirectional reachability encoded in the published 393 Peer TLVs (Section 7.3.1) and - when combined with remote data - 394 results in awareness of bidirectional reachability changes. 396 4.2. Data Transport 398 DNCP has few requirements for the underlying transport; it requires 399 some way of transmitting either unicast datagram or stream data to a 400 peer and, if used in multicast mode, a way of sending multicast 401 datagrams. As multicast is used only to identify potential new DNCP 402 nodes and to send status messages which merely notify that a unicast 403 exchange should be triggered, the multicast transport does not have 404 to be secured. If unicast security is desired and one of the built- 405 in security methods is to be used, support for some TLS-derived 406 transport scheme - such as TLS [RFC5246] on top of TCP or DTLS 407 [RFC6347] on top of UDP - is also required. They provide for 408 integrity protection and confidentiality of the node data, as well as 409 authentication and authorization using the schemes defined in 410 Security and Trust Management (Section 8). A specific definition of 411 the transport(s) in use and their parameters MUST be provided by the 412 DNCP profile. 414 TLVs (Section 7) are sent across the transport as is, and they SHOULD 415 be sent together where, e.g., MTU considerations do not recommend 416 sending them in multiple batches. DNCP does not fragment or 417 reassemble TLVs thus it MUST be ensured that the underlying transport 418 performs these operations should they be necessary. If this document 419 indicates sending one or more TLVs, then the sending node does not 420 need to keep track of the packets sent after handing them over to the 421 respective transport, i.e., reliable DNCP operation is ensured merely 422 by the explicitly defined timers and state machines such as Trickle 423 (Section 4.3). TLVs in general are handled individually and 424 statelessly (and thus do not need to be sent in any particular order) 425 with one exception: To form bidirectional peer relationships DNCP 426 requires identification of the endpoints used for communication. As 427 bidirectional peer relationships are required for validating 428 liveliness of published node data as described in Section 4.6, a DNCP 429 node MUST send a Node Endpoint TLV (Section 7.2.1). When it is sent 430 varies, depending on the underlying transport, but conceptually it 431 should be available whenever processing a Network State TLV: 433 o If using a stream transport, the TLV MUST be sent at least once 434 per connection, but SHOULD NOT be sent more than once. 436 o If using a datagram transport, it MUST be included in every 437 datagram that also contains a Network State TLV (Section 7.2.2) 438 and MUST be located before any such TLV. It SHOULD also be 439 included in any other datagram, to speed up initial peer 440 detection. 442 Given the assorted transport options as well as potential endpoint 443 configuration, a DNCP endpoint may be used in various transport 444 modes: 446 Unicast: 448 * If only reliable unicast transport is used, Trickle is not used 449 at all. Whenever the locally calculated network state hash 450 changes, a single Network State TLV (Section 7.2.2) is sent 451 instead to every unicast peer. Additionally, recently changed 452 Node State TLVs (Section 7.2.3) MAY be included. 454 * If only unreliable unicast transport is used, Trickle state is 455 kept per peer and it is used to send Network State TLVs 456 intermittently, as specified in Section 4.3. 458 Multicast+Unicast: If multicast datagram transport is available on 459 an endpoint, Trickle state is only maintained for the endpoint as 460 a whole. It is used to send Network State TLVs periodically, as 461 specified in Section 4.3. Additionally, per-endpoint keep-alives 462 MAY be defined in the DNCP profile, as specified in Section 6.1.2. 464 MulticastListen+Unicast: Just like Unicast, except multicast 465 transmissions are listened to in order to detect changes of the 466 highest node identifier. This mode is used only if the DNCP 467 profile supports dense multicast-enabled link optimization 468 (Section 6.2). 470 4.3. Trickle-Driven Status Updates 472 The Trickle algorithm [RFC6206] is used to ensure protocol 473 reliability over unreliable multicast or unicast transports. For 474 reliable unicast transports, its actual algorithm is unnecessary and 475 omitted (Section 4.2). DNCP maintains multiple Trickle states as 476 defined in Section 5. Each such state can be based on different 477 parameters (see below) and is responsible for ensuring that a 478 specific peer or all peers on the respective endpoint are regularly 479 provided with the node's current locally calculated network state 480 hash for state comparison, i.e., to detect potential divergence in 481 the perceived network state. 483 Trickle defines 3 parameters: Imin, Imax and k. Imin and Imax 484 represent the minimum value for I and the maximum number of doublings 485 of Imin, where I is the time interval during which at least k Trickle 486 updates must be seen on an endpoint to prevent local state 487 transmission. The actual suggested Trickle algorithm parameters are 488 DNCP profile specific, as described in Section 9. 490 The Trickle state for all Trickle instances defined in Section 5 is 491 considered inconsistent and reset if and only if the locally 492 calculated network state hash changes. This occurs either due to a 493 change in the local node's own node data, or due to receipt of more 494 recent data from another node as explained in Section 4.1. A node 495 MUST NOT reset its Trickle state merely based on receiving a Network 496 State TLV (Section 7.2.2) with a network state hash which is 497 different from its locally calculated one. 499 Every time a particular Trickle instance indicates that an update 500 should be sent, the node MUST send a Network State TLV 501 (Section 7.2.2) if and only if: 503 o the endpoint is in Multicast+Unicast transport mode, in which case 504 the TLV MUST be sent over multicast. 506 o the endpoint is NOT in Multicast+Unicast transport mode, and the 507 unicast transport is unreliable, in which case the TLV MUST be 508 sent over unicast. 510 A (sub)set of all Node State TLVs (Section 7.2.3) MAY also be 511 included, unless it is defined as undesirable for some reason by the 512 DNCP profile, or to avoid exposure of the node state TLVs by 513 transmitting them within insecure multicast when using secure 514 unicast. 516 4.4. Processing of Received TLVs 518 This section describes how received TLVs are processed. The DNCP 519 profile may specify when to ignore particular TLVs, e.g., to modify 520 security properties - see Section 9 for what may be safely defined to 521 be ignored in a profile. Any 'reply' mentioned in the steps below 522 denotes sending of the specified TLV(s) to the originator of the TLV 523 being processed. All such replies MUST be sent using unicast. If 524 the TLV being replied to was received via multicast and it was sent 525 to a multiple access link, the reply MUST be delayed by a random 526 timespan in [0, Imin/2], to avoid potential simultaneous replies that 527 may cause problems on some links, unless specified differently in the 528 DNCP profile. Sending of replies MAY also be rate-limited or omitted 529 for a short period of time by an implementation. However, if the TLV 530 is not forbidden by the DNCP profile, an implementation MUST reply to 531 retransmissions of the TLV with a non-zero probability to avoid 532 starvation which would break the state synchronization. 534 A DNCP node MUST process TLVs received from any valid (e.g., 535 correctly scoped) address, as specified by the DNCP profile and the 536 configuration of a particular endpoint, whether this address is known 537 to be the address of a peer or not. This provision satisfies the 538 needs of monitoring or other host software that needs to discover the 539 DNCP topology without adding to the state in the network. 541 Upon receipt of: 543 o Request Network State TLV (Section 7.1.1): The receiver MUST reply 544 with a Network State TLV (Section 7.2.2) and a Node State TLV 545 (Section 7.2.3) for each node data used to calculate the network 546 state hash. The Node State TLVs SHOULD NOT contain the optional 547 node data part to avoid redundant transmission of node data, 548 unless explicitly specified in the DNCP profile. 550 o Request Node State TLV (Section 7.1.2): If the receiver has node 551 data for the corresponding node, it MUST reply with a Node State 552 TLV (Section 7.2.3) for the corresponding node. The optional node 553 data part MUST be included in the TLV. 555 o Network State TLV (Section 7.2.2): If the network state hash 556 differs from the locally calculated network state hash, and the 557 receiver is unaware of any particular node state differences with 558 the sender, the receiver MUST reply with a Request Network State 559 TLV (Section 7.1.1). These replies MUST be rate limited to only 560 at most one reply per link per unique network state hash within 561 Imin. The simplest way to ensure this rate limit is a timestamp 562 indicating requests, and sending at most one Request Network State 563 TLV (Section 7.1.1) per Imin. To facilitate faster state 564 synchronization, if a Request Network State TLV is sent in a 565 reply, a local, current Network State TLV MAY also be sent. 567 o Node State TLV (Section 7.2.3): 569 * If the node identifier matches the local node identifier and 570 the TLV has a greater sequence number than its current local 571 value, or the same sequence number and a different hash, the 572 node SHOULD re-publish its own node data with a sequence number 573 significantly (e.g., 1000) greater than the received one, to 574 reclaim the node identifier. This difference is needed in 575 order to ensure that it is higher than any potentially 576 lingering copies of the node state in the network. This may 577 occur normally once due to the local node restarting and not 578 storing the most recently used sequence number. If this occurs 579 more than once or for nodes not re-publishing their own node 580 data, the DNCP profile MUST provide guidance on how to handle 581 these situations as it indicates the existence of another 582 active node with the same node identifier. 584 * If the node identifier does not match the local node 585 identifier, and one or more of the following conditions are 586 true: 588 + The local information is outdated for the corresponding node 589 (local sequence number is less than that within the TLV). 591 + The local information is potentially incorrect (local 592 sequence number matches but the node data hash differs). 594 + There is no data for that node altogether. 596 Then: 598 + If the TLV contains the Node Data field, it SHOULD also be 599 verified by ensuring that the locally calculated hash of the 600 Node Data matches the content of the H(Node Data) field 601 within the TLV. If they differ, the TLV SHOULD be ignored 602 and not processed further. 604 + If the TLV does not contain the Node Data field, and the 605 H(Node Data) field within the TLV differs from the local 606 node data hash for that node (or there is none), the 607 receiver MUST reply with a Request Node State TLV 608 (Section 7.1.2) for the corresponding node. 610 + Otherwise the receiver MUST update its locally stored state 611 for that node (node data based on Node Data field if 612 present, sequence number and relative time) to match the 613 received TLV. 615 For comparison purposes of the sequence number, a looping 616 comparison function MUST be used to avoid problems in case of 617 overflow. The comparison function a < b <=> ((a - b) % (2^32)) & 618 (2^31) != 0 where (a % b) represents the remainder of a modulo b 619 and (a & b) represents bitwise conjunction of a and b is 620 RECOMMENDED unless the DNCP profile defines another. 622 o Any other TLV: TLVs not recognized by the receiver MUST be 623 silently ignored unless they are sent within another TLV (for 624 example, TLVs within the Node Data field of a Node State TLV). 626 If secure unicast transport is configured for an endpoint, any Node 627 State TLVs received over insecure multicast MUST be silently ignored. 629 4.5. Discovering, Adding and Removing Peers 631 Peer relations are established between neighbors using one or more 632 mutually connected endpoints. Such neighbors exchange information 633 about network state and published data directly and through 634 transitivity this information then propagates throughout the network. 636 New peers are discovered using the regular unicast or multicast 637 transport defined in the DNCP profile (Section 9). This process is 638 not distinguished from peer addition, i.e., an unknown peer is simply 639 discovered by receiving regular DNCP protocol TLVs from it and 640 dedicated discovery messages or TLVs do not exist. For unicast-only 641 transports, the individual node's transport addresses are 642 preconfigured or obtained using an external service discovery 643 protocol. In the presence of a multicast transport, messages from 644 unknown peers are handled in the same way as multicast messages from 645 peers that are already known, thus new peers are simply discovered 646 when sending their regular DNCP protocol TLVs using multicast. 648 When receiving a Node Endpoint TLV (Section 7.2.1) on an endpoint 649 from an unknown peer: 651 o If received over unicast, the remote node MUST be added as a peer 652 on the endpoint and a Peer TLV (Section 7.3.1) MUST be created for 653 it. 655 o If received over multicast, the node MAY be sent a (possibly rate- 656 limited) unicast Request Network State TLV (Section 7.1.1). 658 If keep-alives specified in Section 6.1 are NOT sent by the peer 659 (either the DNCP profile does not specify the use of keep-alives or 660 the particular peer chooses not to send keep-alives), some other 661 existing local transport-specific means (such as Ethernet carrier- 662 detection or TCP keep-alive) MUST be used to ensure its presence. If 663 the peer does not send keep-alives, and no means to verify presence 664 of the peer are available, the peer MUST be considered no longer 665 present and it SHOULD NOT be added back as a peer until it starts 666 sending keep-alives again. When the peer is no longer present, the 667 Peer TLV and the local DNCP peer state MUST be removed. DNCP does 668 not define an explicit message or TLV for indicating the termination 669 of DNCP operation by the terminating node, however a derived protocol 670 could specify an extension, if the need arises. 672 If the local endpoint is in the Multicast-Listen+Unicast transport 673 mode, a Peer TLV (Section 7.3.1) MUST NOT be published for the peers 674 not having the highest node identifier. 676 4.6. Data Liveliness Validation 678 Maintenance of the hash tree (Section 4.1) and thereby network state 679 hash updates depend on up-to-date information on bidirectional node 680 reachability derived from the contents of a topology graph. This 681 graph changes whenever nodes are added to or removed from the network 682 or when bidirectional connectivity between existing nodes is 683 established or lost. Therefore the graph MUST be updated either 684 immediately or with a small delay shorter than the DNCP profile- 685 defined Trickle Imin, whenever: 687 o A Peer TLV or a whole node is added or removed, or 689 o the origination time (in milliseconds) of some node's node data is 690 less than current time - 2^32 + 2^15. 692 The artificial upper limit for the origination time is used to 693 gracefully avoid overflows of the origination time and allow for the 694 node to republish its data as noted in Section 7.2.3. 696 The topology graph update starts with the local node marked as 697 reachable and all other nodes marked as unreachable. Other nodes are 698 then iteratively marked as reachable using the following algorithm: A 699 candidate not-yet-reachable node N with an endpoint NE is marked as 700 reachable if there is a reachable node R with an endpoint RE that 701 meet all of the following criteria: 703 o The origination time (in milliseconds) of R's node data is greater 704 than current time - 2^32 + 2^15. 706 o R publishes a Peer TLV with: 708 * Peer Node Identifier = N's node identifier 710 * Peer Endpoint Identifier = NE's endpoint identifier 712 * Endpoint Identifier = RE's endpoint identifier 714 o N publishes a Peer TLV with: 716 * Peer Node Identifier = R's node identifier 717 * Peer Endpoint Identifier = RE's endpoint identifier 719 * Endpoint Identifier = NE's endpoint identifier 721 The algorithm terminates, when no more candidate nodes fulfilling 722 these criteria can be found. 724 DNCP nodes that have not been reachable in the most recent topology 725 graph traversal MUST NOT be used for calculation of the network state 726 hash, be provided to any applications that need to use the whole TLV 727 graph, or be provided to remote nodes. They MAY be forgotten 728 immediately after the topology graph traversal, however it is 729 RECOMMENDED to keep them at least briefly to improve the speed of 730 DNCP network state convergence. This reduces the number of queries 731 needed to reconverge during both initial network convergence and when 732 a part of the network loses and regains bidirectional connectivity 733 within that time period. 735 5. Data Model 737 This section describes the local data structures a minimal 738 implementation might use. This section is provided only as a 739 convenience for the implementor. Some of the optional extensions 740 (Section 6) describe additional data requirements, and some optional 741 parts of the core protocol may also require more. 743 A DNCP node has: 745 o A data structure containing data about the most recently sent 746 Request Network State TLVs (Section 7.1.1). The simplest option 747 is keeping a timestamp of the most recent request (required to 748 fulfill reply rate limiting specified in Section 4.4). 750 A DNCP node has for every DNCP node in the DNCP network: 752 o Node identifier: the unique identifier of the node. The length, 753 how it is produced, and how collisions are handled, is up to the 754 DNCP profile. 756 o Node data: the set of TLV tuples published by that particular 757 node. As they are transmitted ordered (see Node State TLV 758 (Section 7.2.3) for details), maintaining the order within the 759 data structure here may be reasonable. 761 o Latest sequence number: the 32-bit sequence number that is 762 incremented any time the TLV set is published. The comparison 763 function used to compare them is described in Section 4.4. 765 o Origination time: the (estimated) time when the current TLV set 766 with the current sequence number was published. It is used to 767 populate the Milliseconds Since Origination field in a Node State 768 TLV (Section 7.2.3). Ideally it also has millisecond accuracy. 770 Additionally, a DNCP node has a set of endpoints for which DNCP is 771 configured to be used. For each such endpoint, a node has: 773 o Endpoint identifier: the 32-bit opaque locally unique value 774 identifying the endpoint within a node. It SHOULD NOT be reused 775 immediately after an endpoint is disabled. 777 o Trickle instance: the endpoint's Trickle instance with parameters 778 I, T, and c (only on an endpoint in Multicast+Unicast transport 779 mode). 781 and one (or more) of the following: 783 o Interface: the assigned local network interface. 785 o Unicast address: the DNCP node it should connect with. 787 o Set of addresses: the DNCP nodes from which connections are 788 accepted. 790 For each remote (peer, endpoint) pair detected on a local endpoint, a 791 DNCP node has: 793 o Node identifier: the unique identifier of the peer. 795 o Endpoint identifier: the unique endpoint identifier used by the 796 peer. 798 o Peer address: the most recently used address of the peer 799 (authenticated and authorized, if security is enabled). 801 o Trickle instance: the particular peer's Trickle instance with 802 parameters I, T, and c (only on an endpoint in Unicast mode, when 803 using an unreliable unicast transport) . 805 6. Optional Extensions 807 This section specifies extensions to the core protocol that a DNCP 808 profile may specify to be used. 810 6.1. Keep-Alives 812 While DNCP provides mechanisms for discovery and adding of new peers 813 on an endpoint (Section 4.5), as well as state change notifications, 814 another mechanism may be needed to get rid of old, no longer valid 815 peers if the transport or lower layers do not provide one as noted in 816 Section 4.6. 818 If keep-alives are not specified in the DNCP profile, the rest of 819 this subsection MUST be ignored. 821 A DNCP profile MAY specify either per-endpoint (sent using multicast 822 to all DNCP nodes connected to a multicast-enabled link) or per-peer 823 (sent using unicast to each peer individually) keep-alive support. 825 For every endpoint that a keep-alive is specified for in the DNCP 826 profile, the endpoint-specific keep-alive interval MUST be 827 maintained. By default, it is DNCP_KEEPALIVE_INTERVAL. If there is 828 a local value that is preferred for that for any reason 829 (configuration, energy conservation, media type, ..), it can be 830 substituted instead. If a non-default keep-alive interval is used on 831 any endpoint, a DNCP node MUST publish appropriate Keep-Alive 832 Interval TLV(s) (Section 7.3.2) within its node data. 834 6.1.1. Data Model Additions 836 The following additions to the Data Model (Section 5) are needed to 837 support keep-alives: 839 For each configured endpoint that has per-endpoint keep-alives 840 enabled: 842 o Last sent: If a timestamp which indicates the last time a Network 843 State TLV (Section 7.2.2) was sent over that interface. 845 For each remote (peer, endpoint) pair detected on a local endpoint, a 846 DNCP node has: 848 o Last contact timestamp: a timestamp which indicates the last time 849 a consistent Network State TLV (Section 7.2.2) was received from 850 the peer over multicast, or anything was received over unicast. 851 Failing to updated it for a certain amount of time as specified in 852 Section 6.1.5 results in the removal of the peer. When adding a 853 new peer, it is initialized to the current time. 855 o Last sent: If per-peer keep-alives are enabled, a timestamp which 856 indicates the last time a Network State TLV (Section 7.2.2) was 857 sent to to that point-to-point peer. When adding a new peer, it 858 is initialized to the current time. 860 6.1.2. Per-Endpoint Periodic Keep-Alives 862 If per-endpoint keep-alives are enabled on an endpoint in 863 Multicast+Unicast transport mode, and if no traffic containing a 864 Network State TLV (Section 7.2.2) has been sent to a particular 865 endpoint within the endpoint-specific keep-alive interval, a Network 866 State TLV (Section 7.2.2) MUST be sent on that endpoint, and a new 867 Trickle interval started, as specified in the step 2 of Section 4.2 868 of [RFC6206]. The actual sending time SHOULD be further delayed by a 869 random timespan in [0, Imin/2]. 871 6.1.3. Per-Peer Periodic Keep-Alives 873 If per-peer keep-alives are enabled on a unicast-only endpoint, and 874 if no traffic containing a Network State TLV (Section 7.2.2) has been 875 sent to a particular peer within the endpoint-specific keep-alive 876 interval, a Network State TLV (Section 7.2.2) MUST be sent to the 877 peer, and a new Trickle interval started, as specified in the step 2 878 of Section 4.2 of [RFC6206]. 880 6.1.4. Received TLV Processing Additions 882 If a TLV is received over unicast from the peer, the Last contact 883 timestamp for the peer MUST be updated. 885 On receipt of a Network State TLV (Section 7.2.2) which is consistent 886 with the locally calculated network state hash, the Last contact 887 timestamp for the peer MUST be updated in order to maintain it as a 888 peer. 890 6.1.5. Peer Removal 892 For every peer on every endpoint, the endpoint-specific keep-alive 893 interval must be calculated by looking for Keep-Alive Interval TLVs 894 (Section 7.3.2) published by the node, and if none exist, using the 895 default value of DNCP_KEEPALIVE_INTERVAL. If the peer's Last contact 896 timestamp has not been updated for at least locally chosen 897 potentially endpoint-specific keep-alive multiplier (defaults to 898 DNCP_KEEPALIVE_MULTIPLIER) times the peer's endpoint-specific keep- 899 alive interval, the Peer TLV for that peer and the local DNCP peer 900 state MUST be removed. 902 6.2. Support For Dense Multicast-Enabled Links 904 This optimization is needed to avoid a state space explosion. Given 905 a large set of DNCP nodes publishing data on an endpoint that uses 906 multicast on a link, every node will add a Peer TLV (Section 7.3.1) 907 for each peer. While Trickle limits the amount of traffic on the 908 link in stable state to some extent, the total amount of data that is 909 added to and maintained in the DNCP network given N nodes on a 910 multicast-enabled link is O(N^2). Additionally if per-peer keep- 911 alives are used, there will be O(N^2) keep-alives running on the link 912 if liveliness of peers is not ensured using some other way (e.g., TCP 913 connection lifetime, layer 2 notification, per-endpoint keep-alive). 915 An upper bound for the number of peers that are allowed for a 916 particular type of link that an endpoint in Multicast+Unicast 917 transport mode is used on SHOULD be provided by a DNCP profile, but 918 MAY also be chosen at runtime. The main consideration when selecting 919 a bound (if any) for a particular type of link should be whether it 920 supports multicast traffic, and whether a too large number of peers 921 case is likely to happen during the use of that DNCP profile on that 922 particular type of link. If neither is likely, there is little point 923 specifying support for this for that particular link type. 925 If a DNCP profile does not support this extension at all, the rest of 926 this subsection MUST be ignored. This is because when this extension 927 is used, the state within the DNCP network only contains a subset of 928 the full topology of the network. Therefore every node must be aware 929 of the potential of it being used in a particular DNCP profile. 931 If the specified upper bound is exceeded for some endpoint in 932 Multicast+Unicast transport mode and if the node does not have the 933 highest node identifier on the link, it SHOULD treat the endpoint as 934 a unicast endpoint connected to the node that has the highest node 935 identifier detected on the link, therefore transitioning to 936 Multicast-listen+Unicast transport mode. See Section 4.2 for 937 implications on the specific endpoint behavior. The nodes in 938 Multicast-listen+Unicast transport mode MUST keep listening to 939 multicast traffic to both receive messages from the node(s) still in 940 Multicast+Unicast mode, and as well to react to nodes with a greater 941 node identifier appearing. If the highest node identifier present on 942 the link changes, the remote unicast address of the endpoints in 943 Multicast-Listen+Unicast transport mode MUST be changed. If the node 944 identifier of the local node is the highest one, the node MUST switch 945 back to, or stay in Multicast+Unicast mode, and form peer 946 relationships with all peers as specified in Section 4.5. 948 7. Type-Length-Value Objects 950 0 1 2 3 951 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 952 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 953 | Type | Length | 954 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 955 | Value (if any) (+padding (if any)) | 956 .. 957 | (variable # of bytes) | 958 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 959 | (Optional nested TLVs) | 960 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 962 Each TLV is encoded as: 964 o a 2 byte Type field 966 o a 2 byte Length field which contains the length of the Value field 967 in bytes; 0 means no Value 969 o the Value itself (if any) 971 o padding bytes with value of zero up to the next 4 byte boundary if 972 the Length is not divisible by 4. 974 While padding bytes MUST NOT be included in the number stored in the 975 Length field of the TLV, if the TLV is enclosed within another TLV, 976 then the padding is included in the enclosing TLV's Length value. 978 Each TLV which does not define optional fields or variable-length 979 content MAY be sent with additional sub-TLVs appended after the TLV 980 to allow for extensibility. When handling such TLV types, each node 981 MUST accept received TLVs that are longer than the fixed fields 982 specified for the particular type, and ignore the sub-TLVs with 983 either unknown types, or not supported within that particular TLV 984 type. If any sub-TLVs are present, the Length field of the TLV 985 describes the number of bytes from the first byte of the TLV's own 986 Value (if any) to the last (padding) byte of the last sub-TLV. 988 For example, type=123 (0x7b) TLV with value 'x' (120 = 0x78) is 989 encoded as: 007B 0001 7800 0000. If it were to have sub-TLV of 990 type=124 (0x7c) with value 'y', it would be encoded as 007B 000C 7800 991 0000 007C 0001 7900 0000. 993 In this section, the following special notation is used: 995 .. = octet string concatenation operation. 997 H(x) = non-cryptographic hash function specified by DNCP profile. 999 7.1. Request TLVs 1001 7.1.1. Request Network State TLV 1003 0 1 2 3 1004 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1005 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1006 | Type: REQ-NETWORK-STATE (1) | Length: >= 0 | 1007 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1009 This TLV is used to request response with a Network State TLV 1010 (Section 7.2.2) and all Node State TLVs (Section 7.2.3) (without node 1011 data). 1013 7.1.2. Request Node State TLV 1015 0 1 2 3 1016 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1017 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1018 | Type: REQ-NODE-STATE (2) | Length: > 0 | 1019 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1020 | Node Identifier | 1021 | (length fixed in DNCP profile) | 1022 ... 1023 | | 1024 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1026 This TLV is used to request a Node State TLV (Section 7.2.3) 1027 (including node data) for the node with the matching node identifier. 1029 7.2. Data TLVs 1031 7.2.1. Node Endpoint TLV 1033 0 1 2 3 1034 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1036 | Type: NODE-ENDPOINT (3) | Length: > 4 | 1037 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1038 | Node Identifier | 1039 | (length fixed in DNCP profile) | 1040 ... 1041 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1042 | Endpoint Identifier | 1043 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1044 This TLV identifies both the local node's node identifier, as well as 1045 the particular endpoint's endpoint identifier. Section 4.2 specifies 1046 when it is sent. 1048 7.2.2. Network State TLV 1050 0 1 2 3 1051 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1052 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1053 | Type: NETWORK-STATE (4) | Length: > 0 | 1054 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1055 | H(sequence number of node 1 .. H(node data of node 1) .. | 1056 | .. sequence number of node N .. H(node data of node N)) | 1057 | (length fixed in DNCP profile) | 1058 ... 1059 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1061 This TLV contains the current locally calculated network state hash, 1062 see Section 4.1 for how it is calculated. 1064 7.2.3. Node State TLV 1066 0 1 2 3 1067 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1068 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1069 | Type: NODE-STATE (5) | Length: > 8 | 1070 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1071 | Node Identifier | 1072 | (length fixed in DNCP profile) | 1073 ... 1074 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1075 | Sequence Number | 1076 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1077 | Milliseconds Since Origination | 1078 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1079 | H(Node Data) | 1080 | (length fixed in DNCP profile) | 1081 ... 1082 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1083 | (optionally) Node Data (a set of nested TLVs) | 1084 ... 1085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1087 This TLV represents the local node's knowledge about the published 1088 state of a node in the DNCP network identified by the Node Identifier 1089 field in the TLV. 1091 Every node, including the node publishing the node data, MUST update 1092 the Milliseconds Since Origination whenever it sends a Node State TLV 1093 based on when the node estimates the data was originally published. 1094 This is, e.g., to ensure that any relative timestamps contained 1095 within the published node data can be correctly offset and 1096 interpreted. Ultimately, what is provided is just an approximation, 1097 as transmission delays are not accounted for. 1099 Absent any changes, if the originating node notices that the 32-bit 1100 milliseconds since origination value would be close to overflow 1101 (greater than 2^32-2^16), the node MUST re-publish its TLVs even if 1102 there is no change. In other words, absent any other changes, the 1103 TLV set MUST be re-published roughly every 48 days. 1105 The actual node data of the node may be included within the TLV as 1106 well in the optional Node Data field. The set of TLVs MUST be 1107 strictly ordered based on ascending binary content (including TLV 1108 type and length). This enables, e.g., efficient state delta 1109 processing and no-copy indexing by TLV type by the recipient. The 1110 Node Data content MUST be passed along exactly as it was received. 1111 It SHOULD be also verified on receipt that the locally calculated 1112 H(Node Data) matches the content of the field within the TLV, and if 1113 the hash differs, the TLV SHOULD be ignored. 1115 7.3. Data TLVs within Node State TLV 1117 These TLVs are published by the DNCP nodes, and therefore only 1118 encoded in the Node Data field of Node State TLVs. If encountered 1119 outside Node State TLV, they MUST be silently ignored. 1121 7.3.1. Peer TLV 1123 0 1 2 3 1124 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1125 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1126 | Type: PEER (8) | Length: > 8 | 1127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1128 | Peer Node Identifier | 1129 | (length fixed in DNCP profile) | 1130 ... 1131 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1132 | Peer Endpoint Identifier | 1133 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1134 | (Local) Endpoint Identifier | 1135 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1137 This TLV indicates that the node in question vouches that the 1138 specified peer is reachable by it on the specified local endpoint. 1140 The presence of this TLV at least guarantees that the node publishing 1141 it has received traffic from the peer recently. For guaranteed up- 1142 to-date bidirectional reachability, the existence of both nodes' 1143 matching Peer TLVs needs to be checked. 1145 7.3.2. Keep-Alive Interval TLV 1147 0 1 2 3 1148 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1150 | Type: KEEP-ALIVE-INTERVAL (9) | Length: >= 8 | 1151 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1152 | Endpoint Identifier | 1153 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1154 | Interval | 1155 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1157 This TLV indicates a non-default interval being used to send keep- 1158 alives specified in Section 6.1. 1160 Endpoint identifier is used to identify the particular (local) 1161 endpoint for which the interval applies on the sending node. If 0, 1162 it applies for ALL endpoints for which no specific TLV exists. 1164 Interval specifies the interval in milliseconds at which the node 1165 sends keep-alives. A value of zero means no keep-alives are sent at 1166 all; in that case, some lower layer mechanism that ensures presence 1167 of nodes MUST be available and used. 1169 8. Security and Trust Management 1171 If specified in the DNCP profile, either DTLS [RFC6347] or TLS 1172 [RFC5246] may be used to authenticate and encrypt either some (if 1173 specified optional in the profile), or all unicast traffic. The 1174 following methods for establishing trust are defined, but it is up to 1175 the DNCP profile to specify which ones may, should or must be 1176 supported. 1178 8.1. Pre-Shared Key Based Trust Method 1180 A PSK-based trust model is a simple security management mechanism 1181 that allows an administrator to deploy devices to an existing network 1182 by configuring them with a pre-defined key, similar to the 1183 configuration of an administrator password or WPA-key. Although 1184 limited in nature it is useful to provide a user-friendly security 1185 mechanism for smaller networks. 1187 8.2. PKI Based Trust Method 1189 A PKI-based trust-model enables more advanced management capabilities 1190 at the cost of increased complexity and bootstrapping effort. It 1191 however allows trust to be managed in a centralized manner and is 1192 therefore useful for larger networks with a need for an authoritative 1193 trust management. 1195 8.3. Certificate Based Trust Consensus Method 1197 For some scenarios - such as bootstrapping a mostly unmanaged network 1198 - the methods described above may not provide a desirable tradeoff 1199 between security and user experience. This section includes guidance 1200 for implementing an opportunistic security [RFC7435] method which 1201 DNCP profiles can build upon and adapt for their specific 1202 requirements. 1204 The certificate-based consensus model is designed to be a compromise 1205 between trust management effort and flexibility. It is based on 1206 X.509-certificates and allows each DNCP node to provide a trust 1207 verdict on any other certificate and a consensus is found to 1208 determine whether a node using this certificate or any certificate 1209 signed by it is to be trusted. 1211 A DNCP node not using this security method MUST ignore all announced 1212 trust verdicts and MUST NOT announce any such verdicts by itself, 1213 i.e., any other normative language in this subsection does not apply 1214 to it. 1216 The current effective trust verdict for any certificate is defined as 1217 the one with the highest priority from all trust verdicts announced 1218 for said certificate at the time. 1220 8.3.1. Trust Verdicts 1222 Trust verdicts are statements of DNCP nodes about the trustworthiness 1223 of X.509-certificates. There are 5 possible trust verdicts in order 1224 of ascending priority: 1226 0 (Neutral): no trust verdict exists but the DNCP network should 1227 determine one. 1229 1 (Cached Trust): the last known effective trust verdict was 1230 Configured or Cached Trust. 1232 2 (Cached Distrust): the last known effective trust verdict was 1233 Configured or Cached Distrust. 1235 3 (Configured Trust): trustworthy based upon an external ceremony 1236 or configuration. 1238 4 (Configured Distrust): not trustworthy based upon an external 1239 ceremony or configuration. 1241 Trust verdicts are differentiated in 3 groups: 1243 o Configured verdicts are used to announce explicit trust verdicts a 1244 node has based on any external trust bootstrap or predefined 1245 relation a node has formed with a given certificate. 1247 o Cached verdicts are used to retain the last known trust state in 1248 case all nodes with configured verdicts about a given certificate 1249 have been disconnected or turned off. 1251 o The Neutral verdict is used to announce a new node intending to 1252 join the network so a final verdict for it can be found. 1254 The current effective trust verdict for any certificate is defined as 1255 the one with the highest priority within the set of trust verdicts 1256 announced for the certificate in the DNCP network. A node MUST be 1257 trusted for participating in the DNCP network if and only if the 1258 current effective trust verdict for its own certificate or any one in 1259 its certificate hierarchy is (Cached or Configured) Trust and none of 1260 the certificates in its hierarchy have an effective trust verdict of 1261 (Cached or Configured) Distrust. In case a node has a configured 1262 verdict, which is different from the current effective trust verdict 1263 for a certificate, the current effective trust verdict takes 1264 precedence in deciding trustworthiness. Despite that, the node still 1265 retains and announces its configured verdict. 1267 8.3.2. Trust Cache 1269 Each node SHOULD maintain a trust cache containing the current 1270 effective trust verdicts for all certificates currently announced in 1271 the DNCP network. This cache is used as a backup of the last known 1272 state in case there is no node announcing a configured verdict for a 1273 known certificate. It SHOULD be saved to a non-volatile memory at 1274 reasonable time intervals to survive a reboot or power outage. 1276 Every time a node (re)joins the network or detects the change of an 1277 effective trust verdict for any certificate, it will synchronize its 1278 cache, i.e., store new effective trust verdicts overwriting any 1279 previously cached verdicts. Configured verdicts are stored in the 1280 cache as their respective cached counterparts. Neutral verdicts are 1281 never stored and do not override existing cached verdicts. 1283 8.3.3. Announcement of Verdicts 1285 A node SHOULD always announce any configured trust verdicts it has 1286 established by itself, and it MUST do so if announcing the configured 1287 trust verdict leads to a change in the current effective trust 1288 verdict for the respective certificate. In absence of configured 1289 verdicts, it MUST announce cached trust verdicts it has stored in its 1290 trust cache, if one of the following conditions applies: 1292 o The stored trust verdict is Cached Trust and the current effective 1293 trust verdict for the certificate is Neutral or does not exist. 1295 o The stored trust verdict is Cached Distrust and the current 1296 effective trust verdict for the certificate is Cached Trust. 1298 A node rechecks these conditions whenever it detects changes of 1299 announced trust verdicts anywhere in the network. 1301 Upon encountering a node with a hierarchy of certificates for which 1302 there is no effective trust verdict, a node adds a Neutral Trust- 1303 Verdict-TLV to its node data for all certificates found in the 1304 hierarchy, and publishes it until an effective trust verdict 1305 different from Neutral can be found for any of the certificates, or a 1306 reasonable amount of time (10 minutes is suggested) with no reaction 1307 and no further authentication attempts has passed. Such trust 1308 verdicts SHOULD also be limited in rate and number to prevent denial- 1309 of-service attacks. 1311 Trust verdicts are announced using Trust-Verdict TLVs: 1313 0 1 2 3 1314 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1315 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1316 | Type: Trust-Verdict (10) | Length: > 36 | 1317 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1318 | Verdict | (reserved) | 1319 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1320 | | 1321 | | 1322 | | 1323 | SHA-256 Fingerprint | 1324 | | 1325 | | 1326 | | 1327 | | 1328 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1329 | Common Name | 1330 Verdict represents the numerical index of the trust verdict. 1332 (reserved) is reserved for future additions and MUST be set to 0 1333 when creating TLVs and ignored when parsing them. 1335 SHA-256 Fingerprint contains the SHA-256 [RFC6234] hash value of 1336 the certificate in DER-format. 1338 Common Name contains the variable-length (1-64 bytes) common name 1339 of the certificate. 1341 8.3.4. Bootstrap Ceremonies 1343 The following non-exhaustive list of methods describes possible ways 1344 to establish trust relationships between DNCP nodes and node 1345 certificates. Trust establishment is a two-way process in which the 1346 existing network must trust the newly added node and the newly added 1347 node must trust at least one of its peer nodes. It is therefore 1348 necessary that both the newly added node and an already trusted node 1349 perform such a ceremony to successfully introduce a node into the 1350 DNCP network. In all cases an administrator MUST be provided with 1351 external means to identify the node belonging to a certificate based 1352 on its fingerprint and a meaningful common name. 1354 8.3.4.1. Trust by Identification 1356 A node implementing certificate-based trust MUST provide an interface 1357 to retrieve the current set of effective trust verdicts, fingerprints 1358 and names of all certificates currently known and set configured 1359 trust verdicts to be announced. Alternatively it MAY provide a 1360 companion DNCP node or application with these capabilities with which 1361 it has a pre-established trust relationship. 1363 8.3.4.2. Preconfigured Trust 1365 A node MAY be preconfigured to trust a certain set of node or CA 1366 certificates. However such trust relationships MUST NOT result in 1367 unwanted or unrelated trust for nodes not intended to be run inside 1368 the same network (e.g., all other devices by the same manufacturer). 1370 8.3.4.3. Trust on Button Press 1372 A node MAY provide a physical or virtual interface to put one or more 1373 of its internal network interfaces temporarily into a mode in which 1374 it trusts the certificate of the first DNCP node it can successfully 1375 establish a connection with. 1377 8.3.4.4. Trust on First Use 1379 A node which is not associated with any other DNCP node MAY trust the 1380 certificate of the first DNCP node it can successfully establish a 1381 connection with. This method MUST NOT be used when the node has 1382 already associated with any other DNCP node. 1384 9. DNCP Profile-Specific Definitions 1386 Each DNCP profile MUST specify the following aspects: 1388 o Unicast and optionally multicast transport protocol(s) to be used. 1389 If multicast-based node and status discovery is desired, a 1390 datagram-based transport supporting multicast has to be available. 1392 o How the chosen transport(s) are secured: Not at all, optionally or 1393 always with the TLS scheme defined here using one or more of the 1394 methods, or with something else. If the links with DNCP nodes can 1395 be sufficiently secured or isolated, it is possible to run DNCP in 1396 a secure manner without using any form of authentication or 1397 encryption. 1399 o Transport protocols' parameters such as port numbers to be used, 1400 or multicast address to be used. Unicast, multicast, and secure 1401 unicast may each require different parameters, if applicable. 1403 o When receiving TLVs, what sort of TLVs are ignored in addition - 1404 as specified in Section 4.4 - e.g., for security reasons. While 1405 the security of the node data published within the Node State TLVs 1406 is already ensured by the base specification (if secure mode is 1407 enabled, Node State TLVs are sent only via unicast as multicast 1408 ones are ignored on receipt), if a profile adds TLVs that are sent 1409 outside the node data, a profile should indicate whether or not 1410 those TLVs should be ignored if they are received via multicast or 1411 non-secured unicast. A DNCP profile may define the following DNCP 1412 TLVs to be safely ignored: 1414 * Anything received over multicast, except Node Endpoint TLV 1415 (Section 7.2.1) and Network State TLV (Section 7.2.2). 1417 * Any TLVs received over unreliable unicast or multicast at too 1418 high rate; Trickle will ensure eventual convergence given the 1419 rate slows down at some point. 1421 o How to deal with node identifier collision as described in 1422 Section 4.4. Main options are either for one or both nodes to 1423 assign new node identifiers to themselves, or to notify someone 1424 about a fatal error condition in the DNCP network. 1426 o Imin, Imax and k ranges to be suggested for implementations to be 1427 used in the Trickle algorithm. The Trickle algorithm does not 1428 require these to be the same across all implementations for it to 1429 work, but similar orders of magnitude helps implementations of a 1430 DNCP profile to behave more consistently and to facilitate 1431 estimation of lower and upper bounds for convergence behavior of 1432 the network. 1434 o Hash function H(x) to be used, and how many bits of the output are 1435 actually used. The chosen hash function is used to handle both 1436 hashing of node specific data, and network state hash, which is a 1437 hash of node specific data hashes. SHA-256 defined in [RFC6234] 1438 is the recommended default choice, but a non-cryptographic hash 1439 function could be used as well. 1441 o DNCP_NODE_IDENTIFIER_LENGTH: The fixed length of a node identifier 1442 (in bytes). 1444 o Whether to send keep-alives, and if so, whether per-endpoint 1445 (requires multicast transport), or per-peer. Keep-alive has also 1446 associated parameters: 1448 * DNCP_KEEPALIVE_INTERVAL: How often keep-alives are to be sent 1449 by default (if enabled). 1451 * DNCP_KEEPALIVE_MULTIPLIER: How many times the 1452 DNCP_KEEPALIVE_INTERVAL (or peer-supplied keep-alive interval 1453 value) a node may not be heard from to be considered still 1454 valid. This is just a default used in absence of any other 1455 configuration information, or particular per-endpoint 1456 configuration. 1458 o Whether to support dense multicast-enabled link optimization 1459 (Section 6.2) or not. 1461 For some guidance on choosing transport and security options, please 1462 see Appendix B. 1464 10. Security Considerations 1466 DNCP-based protocols may use multicast to indicate DNCP state changes 1467 and for keep-alive purposes. However, no actual published data TLVs 1468 will be sent across that channel. Therefore an attacker may only 1469 learn hash values of the state within DNCP and may be able to trigger 1470 unicast synchronization attempts between nodes on a local link this 1471 way. A DNCP node MUST therefore rate-limit its reactions to 1472 multicast packets. 1474 When using DNCP to bootstrap a network, PKI based solutions may have 1475 issues when validating certificates due to potentially unavailable 1476 accurate time, or due to inability to use the network to either check 1477 Certificate Revocation Lists or perform on-line validation. 1479 The Certificate-based trust consensus mechanism defined in this 1480 document allows for a consenting revocation, however in case of a 1481 compromised device the trust cache may be poisoned before the actual 1482 revocation happens allowing the distrusted device to rejoin the 1483 network using a different identity. Stopping such an attack might 1484 require physical intervention and flushing of the trust caches. 1486 11. IANA Considerations 1488 IANA should set up a registry for the (decimal 16-bit) "DNCP TLV 1489 Types" under "Distributed Node Consensus Protocol (DNCP)", with the 1490 following initial contents: ([RFC Editor: please remove] ideally as 1491 http://www.iana.org/assignments/dncp-registry) 1493 0: Reserved 1495 1: Request network state 1497 2: Request node state 1499 3: Node endpoint 1501 4: Network state 1503 5: Node state 1505 6: Reserved (was: Custom) 1507 7: Reserved (was: Fragment count) 1509 8: Peer 1511 9: Keep-alive interval 1513 10: Trust-Verdict 1515 11-31: Free - policy of standards action [RFC5226] should be used 1517 32-511: Reserved for per-DNCP profile use 1519 512-767: Free - policy of standards action [RFC5226] should be 1520 used 1521 768-1023: Private use [RFC5226] 1523 1024-65535: Reserved for future protocol evolution (for example, 1524 DNCP version 2) 1526 12. References 1528 12.1. Normative references 1530 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1531 Requirement Levels", BCP 14, RFC 2119, March 1997. 1533 [RFC6206] Levis, P., Clausen, T., Hui, J., Gnawali, O., and J. Ko, 1534 "The Trickle Algorithm", RFC 6206, March 2011. 1536 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1537 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 1539 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1540 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1541 DOI 10.17487/RFC5226, May 2008, 1542 . 1544 12.2. Informative references 1546 [RFC3493] Gilligan, R., Thomson, S., Bound, J., McCann, J., and W. 1547 Stevens, "Basic Socket Interface Extensions for IPv6", RFC 1548 3493, February 2003. 1550 [RFC3315] Droms, R., Bound, J., Volz, B., Lemon, T., Perkins, C., 1551 and M. Carney, "Dynamic Host Configuration Protocol for 1552 IPv6 (DHCPv6)", RFC 3315, July 2003. 1554 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 1555 Security Version 1.2", RFC 6347, January 2012. 1557 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1558 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1560 [RFC7435] Dukhovni, V., "Opportunistic Security: Some Protection 1561 Most of the Time", RFC 7435, DOI 10.17487/RFC7435, 1562 December 2014, . 1564 [I-D.ietf-homenet-prefix-assignment] 1565 Pfister, P., Paterson, B., and J. Arkko, "Distributed 1566 Prefix Assignment Algorithm", draft-ietf-homenet-prefix- 1567 assignment-08 (work in progress), August 2015. 1569 Appendix A. Alternative Modes of Operation 1571 Beyond what is described in the main text, the protocol allows for 1572 other uses. These are provided as examples. 1574 A.1. Read-only Operation 1576 If a node uses just a single endpoint and does not need to publish 1577 any TLVs, full DNCP node functionality is not required. Such limited 1578 node can acquire and maintain view of the TLV space by implementing 1579 the processing logic as specified in Section 4.4. Such node would 1580 not need Trickle, peer-maintenance or even keep-alives at all, as the 1581 DNCP nodes' use of it would guarantee eventual receipt of network 1582 state hashes, and synchronization of node data, even in presence of 1583 unreliable transport. 1585 A.2. Forwarding Operation 1587 If a node with a pair of endpoints does not need to publish any TLVs, 1588 it can detect (for example) nodes with the highest node identifier on 1589 each of the endpoints (if any). Any TLVs received from one of them 1590 would be forwarded verbatim as unicast to the other node with highest 1591 node identifier. 1593 Any tinkering with the TLVs would remove guarantees of this scheme 1594 working; however passive monitoring would obviously be fine. This 1595 type of simple forwarding cannot be chained, as it does not send 1596 anything proactively. 1598 Appendix B. DNCP Profile Additional Guidance 1600 This appendix explains implications of design choices made when 1601 specifying DNCP profile to use particular transport or security 1602 options. 1604 B.1. Unicast Transport - UDP or TCP? 1606 The node data published by a DNCP node is limited to 64KB due to the 1607 16-bit size of the length field of the TLV it is published within. 1608 Some transport choices may decrease this limit; if using e.g. UDP 1609 datagrams for unicast transport the upper bound of node data size is 1610 whatever the nodes and the underlying network can pass to each other 1611 as DNCP does not define its own fragmentation scheme. A profile 1612 which chooses UDP has to be limited to small node data (e.g. somewhat 1613 smaller than IPv6 default MTU if using IPv6), or specify a minimum 1614 which all nodes have to support. Even then, if using non-link-local 1615 communications, there is some concern about what middleboxes do to 1616 fragmented packets. Therefore, the use of stream transport such as 1617 TCP is probably a good idea if either non-link-local communication is 1618 desired, or fragmentation is expected to cause problems. 1620 TCP also provides some other facilities, such as a relatively long 1621 built-in keep-alive which in conjunction with connection closes 1622 occurring from eventual failed retransmissions may be sufficient to 1623 avoid the use of in-protocol keep-alive defined in Section 6.1. 1624 Additionally it is reliable, so there is no need for Trickle on such 1625 unicast connections. 1627 The major downside of using TCP instead of UDP with DNCP-based 1628 profiles lies in the loss of control over the time at which TLVs are 1629 received; while unreliable UDP datagrams also have some delay, TLVs 1630 within reliable stream transport may be delayed significantly due to 1631 retransmissions. This is not a problem if no relative time dependent 1632 information is stored within the TLVs in the DNCP-based protocol; for 1633 such a protocol, TCP is a reasonable choice for unicast transport if 1634 it is available. 1636 B.2. (Optional) Multicast Transport 1638 Multicast is needed for dynamic peer discovery and to trigger unicast 1639 exchanges; for that, unreliable datagram transport (=typically UDP) 1640 is the only transport option defined within this specification, 1641 although DNCP-based protocols may themselves define some other 1642 transport or peer discovery mechanism (e.g. based on mDNS or DNS). 1644 If multicast is used, a well-known address should be specified, and 1645 for e.g. IPv6 respectively the desired address scopes. In most 1646 cases link-local and possibly site-local are useful scopes. 1648 B.3. (Optional) Transport Security 1650 In terms of provided security, DTLS and TLS are equivalent; they also 1651 consume similar amount of state on the devices. While TLS is on top 1652 of a stream protocol, using DTLS also requires relatively long 1653 session caching within the DTLS layer to avoid expensive re- 1654 authentication/authorization steps if and when any state within the 1655 DNCP network changes or per-peer keep-alive (if enabled) is sent. 1657 TLS implementations (at the time of the writing of the specification) 1658 seem more mature and available (as open source) than DTLS ones. This 1659 may be due to a long history of use with HTTPS. 1661 Some libraries seem not to support multiplexing between insecure and 1662 secure communication on the same port, so specifying distinct ports 1663 for secured and unsecured communication may be beneficial. 1665 Appendix C. Example Profile 1667 This is the DNCP profile of SHSP, an experimental (and for the 1668 purposes of this document fictional) home automation protocol. The 1669 protocol itself is used to make key-value store published by each of 1670 the nodes available to all other nodes for distributed monitoring and 1671 control of a home infrastructure. It defines only one additional TLV 1672 type: a key=value TLV which contains a single key=value assignment 1673 for publication. 1675 o Unicast transport: IPv6 TCP on port EXAMPLE-P1 since only absolute 1676 timestamps are used within the key=value data and since it focuses 1677 primarily on Linux-based nodes which support both protocols well. 1678 Connections from and to non-link-local addresses are ignored to 1679 avoid exposing this protocol outside the secure links. 1681 o Multicast transport: IPv6 UDP on port EXAMPLE-P2 to link-local 1682 scoped multicast address ff02:EXAMPLE. At least one node per link 1683 in the home is assumed to facilitate node discovery without 1684 depending on any other infrastructure. 1686 o Security: None. It is to be used only on trusted links (WPA2-x 1687 wireless, physically secure wired links). 1689 o Additional TLVs to be ignored: None. No DNCP security is 1690 specified, and no new TLVs are defined outside of node data. 1692 o Node identifier length (DNCP_NODE_IDENTIFIER_LENGTH): 32 bits that 1693 are randomly generated. 1695 o Node identifier collision handling: Pick new random node 1696 identifier. 1698 o Trickle parameters: Imin = 200ms, Imax = 7, k = 1. It means at 1699 least one multicast per link in 25 seconds in stable state (0.2 * 1700 2^7). 1702 o Hash function H(x) + length: SHA-256, only 128 bits used. 1703 Relatively fast, and 128 bits should be plenty to prevent random 1704 conflicts (64 bits would most likely be sufficient, too). 1706 o No in-protocol keep-alives (Section 6.1); TCP keep-alive is to be 1707 used. In practice TCP keep-alive is seldom encountered anyway as 1708 changes in network state cause packets to be sent on the unicast 1709 connections, and those that fail sufficiently many retransmissions 1710 are dropped much before keep-alive actually would fire. 1712 o No support for dense multicast-enabled link optimization 1713 (Section 6.2); SHSP is a simple protocol for few nodes (network- 1714 wide, not even to mention on a single link), and therefore would 1715 not provide any benefit. 1717 Appendix D. Some Questions and Answers [RFC Editor: please remove] 1719 Q: 32-bit endpoint id? 1721 A: Here, it would save 32 bits per peer if it was 16 bits (and less 1722 is not realistic). However, TLVs defined elsewhere would not seem to 1723 even gain that much on average. 32 bits is also used for ifindex in 1724 various operating systems, making for simpler implementation. 1726 Q: Why have topology information at all? 1728 A: It is an alternative to the more traditional seq#/TTL-based 1729 flooding schemes. In steady state, there is no need to, e.g., re- 1730 publish every now and then. 1732 Appendix E. Changelog [RFC Editor: please remove] 1734 draft-ietf-homenet-dncp-10: 1736 o Added profile guidance section, as well as example profile. 1738 draft-ietf-homenet-dncp-09: 1740 o Reserved 1024+ TLV types for future versions (=versioning 1741 mechanism); private use section moved from 192-255 to 512-767. 1743 o Added applicability statement and clarified some text based on 1744 reviews. 1746 draft-ietf-homenet-dncp-08: 1748 o Removed fragmentation as it is somewhat underspecified and 1749 unimplemented. It may be specified in some future extension draft 1750 or new version of DNCP. 1752 o Added generic sub-TLV extensibility mechanism. 1754 draft-ietf-homenet-dncp-06: 1756 o Removed custom TLV. 1758 o Made keep-alive multipliers local implementation choice, profiles 1759 just provide guidance on sane default value. 1761 o Removed the DNCP_GRACE_INTERVAL as it is really implementation 1762 choice. 1764 o Simplified the suggested structures in data model. 1766 o Reorganized the document and provided an overview section. 1768 draft-ietf-homenet-dncp-04: 1770 o Added mandatory rate limiting for network state requests, and 1771 optional slightly faster convergence mechanism by including 1772 current local network state in the remote network state requests. 1774 draft-ietf-homenet-dncp-03: 1776 o Renamed connection -> endpoint. 1778 o !!! Backwards incompatible change: Renumbered TLVs, and got rid of 1779 node data TLV; instead, node data TLV's contents are optionally 1780 within node state TLV. 1782 draft-ietf-homenet-dncp-02: 1784 o Changed DNCP "messages" into series of TLV streams, allowing 1785 optimized round-trip saving synchronization. 1787 o Added fragmentation support for bigger node data and for chunking 1788 in absence of reliable L2 and L3 fragmentation. 1790 draft-ietf-homenet-dncp-01: 1792 o Fixed keep-alive semantics to consider unicast requests also 1793 updates of most recently consistent, and added proactive unicast 1794 request to ensure even inconsistent keep-alive messages eventually 1795 triggering consistency timestamp update. 1797 o Facilitated (simple) read-only clients by making Node Connection 1798 TLV optional if just using DNCP for read-only purposes. 1800 o Added text describing how to deal with "dense" networks, but left 1801 actual numbers and mechanics up to DNCP profiles and (local) 1802 configurations. 1804 draft-ietf-homenet-dncp-00: Split from pre-version of draft-ietf- 1805 homenet-hncp-03 generic parts. Changes that affect implementations: 1807 o TLVs were renumbered. 1809 o TLV length does not include header (=-4). This facilitates, e.g., 1810 use of DHCPv6 option parsing libraries (same encoding), and 1811 reduces complexity (no need to handle error values of length less 1812 than 4). 1814 o Trickle is reset only when locally calculated network state hash 1815 is changes, not as remote different network state hash is seen. 1816 This prevents, e.g., attacks by multicast with one multicast 1817 packet to force Trickle reset on every interface of every node on 1818 a link. 1820 o Instead of 'ping', use 'keep-alive' (optional) for dead peer 1821 detection. Different message used! 1823 Appendix F. Draft Source [RFC Editor: please remove] 1825 As usual, this draft is available at https://github.com/fingon/ietf- 1826 drafts/ in source format (with nice Makefile too). Feel free to send 1827 comments and/or pull requests if and when you have changes to it! 1829 Appendix G. Acknowledgements 1831 Thanks to Ole Troan, Pierre Pfister, Mark Baugher, Mark Townsley, 1832 Juliusz Chroboczek, Jiazi Yi, Mikael Abrahamsson, Brian Carpenter, 1833 Thomas Clausen, DENG Hui and Margaret Cullen for their contributions 1834 to the draft. 1836 Thanks to Kaiwen Jin and Xavier Bonnetain for their related research 1837 work. 1839 Authors' Addresses 1841 Markus Stenberg 1842 Independent 1843 Helsinki 00930 1844 Finland 1846 Email: markus.stenberg@iki.fi 1848 Steven Barth 1849 Independent 1850 Halle 06114 1851 Germany 1853 Email: cyrus@openwrt.org