idnits 2.17.1 draft-ietf-homenet-dncp-12.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 271 has weird spacing: '...ntifier an o...' == Line 307 has weird spacing: '...on Time the (...' == Line 329 has weird spacing: '...e trust the ...' == Line 333 has weird spacing: '...y graph the...' == Line 337 has weird spacing: '...ionally a pe...' == (1 more instance...) -- The document date (November 2, 2015) is 3099 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: May 5, 2016 November 2, 2015 7 Distributed Node Consensus Protocol 8 draft-ietf-homenet-dncp-12 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 May 5, 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 . . . . . . . . . . . . . . . . . . . . . . . . . 6 55 2.1. Requirements Language . . . . . . . . . . . . . . . . . . 8 56 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 8 57 4. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 9 58 4.1. Hash Tree . . . . . . . . . . . . . . . . . . . . . . . . 9 59 4.1.1. Calculating network state and node data hashes . . . 9 60 4.1.2. Updating network state and node data hashes . . . . . 10 61 4.2. Data Transport . . . . . . . . . . . . . . . . . . . . . 10 62 4.3. Trickle-Driven Status Updates . . . . . . . . . . . . . . 11 63 4.4. Processing of Received TLVs . . . . . . . . . . . . . . . 12 64 4.5. Discovering, Adding and Removing Peers . . . . . . . . . 15 65 4.6. Data Liveliness Validation . . . . . . . . . . . . . . . 16 66 5. Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 17 67 6. Optional Extensions . . . . . . . . . . . . . . . . . . . . . 19 68 6.1. Keep-Alives . . . . . . . . . . . . . . . . . . . . . . . 19 69 6.1.1. Data Model Additions . . . . . . . . . . . . . . . . 19 70 6.1.2. Per-Endpoint Periodic Keep-Alives . . . . . . . . . . 20 71 6.1.3. Per-Peer Periodic Keep-Alives . . . . . . . . . . . . 20 72 6.1.4. Received TLV Processing Additions . . . . . . . . . . 20 73 6.1.5. Peer Removal . . . . . . . . . . . . . . . . . . . . 20 74 6.2. Support For Dense Multicast-Enabled Links . . . . . . . . 21 75 7. Type-Length-Value Objects . . . . . . . . . . . . . . . . . . 22 76 7.1. Request TLVs . . . . . . . . . . . . . . . . . . . . . . 23 77 7.1.1. Request Network State TLV . . . . . . . . . . . . . . 23 78 7.1.2. Request Node State TLV . . . . . . . . . . . . . . . 23 79 7.2. Data TLVs . . . . . . . . . . . . . . . . . . . . . . . . 23 80 7.2.1. Node Endpoint TLV . . . . . . . . . . . . . . . . . . 23 81 7.2.2. Network State TLV . . . . . . . . . . . . . . . . . . 24 82 7.2.3. Node State TLV . . . . . . . . . . . . . . . . . . . 24 83 7.3. Data TLVs within Node State TLV . . . . . . . . . . . . . 25 84 7.3.1. Peer TLV . . . . . . . . . . . . . . . . . . . . . . 25 85 7.3.2. Keep-Alive Interval TLV . . . . . . . . . . . . . . . 26 86 8. Security and Trust Management . . . . . . . . . . . . . . . . 26 87 8.1. Pre-Shared Key Based Trust Method . . . . . . . . . . . . 26 88 8.2. PKI Based Trust Method . . . . . . . . . . . . . . . . . 27 89 8.3. Certificate Based Trust Consensus Method . . . . . . . . 27 90 8.3.1. Trust Verdicts . . . . . . . . . . . . . . . . . . . 27 91 8.3.2. Trust Cache . . . . . . . . . . . . . . . . . . . . . 28 92 8.3.3. Announcement of Verdicts . . . . . . . . . . . . . . 29 93 8.3.4. Bootstrap Ceremonies . . . . . . . . . . . . . . . . 30 94 9. DNCP Profile-Specific Definitions . . . . . . . . . . . . . . 31 95 10. Security Considerations . . . . . . . . . . . . . . . . . . . 33 96 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 33 97 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 34 98 12.1. Normative references . . . . . . . . . . . . . . . . . . 34 99 12.2. Informative references . . . . . . . . . . . . . . . . . 34 100 Appendix A. Alternative Modes of Operation . . . . . . . . . . . 35 101 A.1. Read-only Operation . . . . . . . . . . . . . . . . . . . 35 102 A.2. Forwarding Operation . . . . . . . . . . . . . . . . . . 35 103 Appendix B. DNCP Profile Additional Guidance . . . . . . . . . . 36 104 B.1. Unicast Transport - UDP or TCP? . . . . . . . . . . . . . 36 105 B.2. (Optional) Multicast Transport . . . . . . . . . . . . . 36 106 B.3. (Optional) Transport Security . . . . . . . . . . . . . . 37 107 Appendix C. Example Profile . . . . . . . . . . . . . . . . . . 37 108 Appendix D. Some Questions and Answers [RFC Editor: please 109 remove] . . . . . . . . . . . . . . . . . . . . . . 38 110 Appendix E. Changelog [RFC Editor: please remove] . . . . . . . 38 111 Appendix F. Draft Source [RFC Editor: please remove] . . . . . . 40 112 Appendix G. Acknowledgements . . . . . . . . . . . . . . . . . . 40 113 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 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. DNCP is abstract, which allows it to be tuned to a 146 variety of applications by defining profiles. These profiles include 147 choices of: 149 - unicast transport: datagram or stream oriented protocol (e.g., 150 TCP, UDP, SCTP) for generic protocol operation 152 - optional transport security: whether and when to use security 153 based on (D)TLS, if supported over the chosen transport 155 - optional multicast transport: multicast-capable protocol like UDP 156 allowing autonomous peer discovery or more efficient use of 157 multiple access links 159 - communication scopes: either hop-by-hop only relying on link-local 160 addressing (e.g., for LANs) or using addresses with broader scopes 161 (e.g. over WANs or the internet) relying on an existing routing 162 infrastructure or a combination of both (e.g., to exchange state 163 between multiple LANs over a WAN or the internet) 165 - payloads: additional specific payloads (e.g., IANA standardized, 166 enterprise-specific or private use) 168 - extensions: possible protocol extensions, either as predefined in 169 this document or specific for a particular usecase 171 However, there are certain cases where the protocol as defined in 172 this document is a less suitable choice. This list provides an 173 overview while the following paragraphs provide more detailed 174 guidance on the individual matters. 176 - large amounts of data: nodes are limited to 64KB of published data 178 - very dense unicast-only networks: nodes include information about 179 all immediate neighbors as part of their published data. 181 - predominantly minimal data changes: Node data is always 182 transported as-is, leading to a relatively large transmission 183 overhead for changes affecting only a small part of it. 185 - frequently changing data: DNCP with its use of Trickle is 186 optimized for the steady state and less efficient otherwise. 188 - large amounts of very constrained nodes: DNCP requires each node 189 to store the entirety of the data published by all nodes. 191 The topology of the devices is not limited and automatically 192 discovered. When relying on link-local communication exclusively, 193 all links having DNCP nodes need to be at least transitively 194 connected by routers running the protocol on multiple endpoints in 195 order to form a connected network. However, there is no requirement 196 for every device in a physical network to run the protocol. 197 Especially if globally scoped addresses are used, DNCP peers do not 198 need to be on the same or even neighboring physical links. 199 Autonomous discovery features are usually used in local network 200 scenario however - with security enabled - DNCP can also be used over 201 unsecured public networks. Network size is restricted merely by the 202 capabilities of the devices, i.e., each DNCP node needs to be able to 203 store the entirety of the data published by all nodes. The data 204 associated with each individual node identifier is limited to about 205 64KB in this document, however protocol extensions could be defined 206 to mitigate this or other protocol limitations if the need arises. 208 DNCP is most suitable for data that changes only infrequently to gain 209 the maximum benefit from using Trickle. As the network of nodes 210 grows, or the frequency of data changes per node increases, Trickle 211 is eventually used less and less and the benefit of using DNCP 212 diminishes. In these cases Trickle just provides extra complexity 213 within the specification and little added value. 215 The suitability of DNCP for a particular application can roughly be 216 evaluated by considering the expected average network-wide state 217 change interval A_NC_I; it is computed by dividing the mean interval 218 at which a node originates a new TLV set by the number of 219 participating nodes. If keep-alives are used, A_NC_I is the minimum 220 of the computed A_NC_I and the keep-alive interval. If A_NC_I is 221 less than the (application-specific) Trickle minimum interval, DNCP 222 is most likely unsuitable for the application as Trickle will not be 223 utilized most of the time. 225 If constant rapid state changes are needed, the preferable choice is 226 to use an additional point-to-point channel whose address or locator 227 is published using DNCP. Nevertheless, if doing so does not raise 228 A_NC_I above the (sensibly chosen) Trickle interval parameters for a 229 particular application, using DNCP is probably not suitable for the 230 application. 232 Another consideration is the size of the published TLV set by a node 233 compared to the size of deltas in the TLV set. If the TLV set 234 published by a node is very large, and has frequent small changes, 235 DNCP as currently specified in this specification may be unsuitable 236 as it lacks a delta synchronization scheme to keep implementation 237 simple. 239 DNCP can be used in networks where only unicast transport is 240 available. While DNCP uses the least amount of bandwidth when 241 multicast is utilized, even in pure unicast mode, the use of Trickle 242 (ideally with k < 2) results in a protocol with an exponential 243 backoff timer and fewer transmissions than a simpler protocol not 244 using Trickle. 246 2. Terminology 248 DNCP profile the values for the set of parameters, given in 249 Section 9. They are prefixed with DNCP_ in this 250 document. The profile also specifies the set of 251 optional DNCP extensions to be used. For a simple 252 example DNCP profile, see Appendix C. 254 DNCP-based a protocol which provides a DNCP profile, according 255 protocol to Section 9, and zero or more TLV assignments from 256 the per-DNCP profile TLV registry as well as their 257 processing rules. 259 DNCP node a single node which runs a DNCP-based protocol. 261 Link a link-layer media over which directly connected 262 nodes can communicate. 264 DNCP network a set of DNCP nodes running DNCP-based protocol(s) 265 with matching DNCP profile(s). The set consists of 266 nodes that have discovered each other using the 267 transport method defined in the DNCP profile, via 268 multicast on local links, and / or by using unicast 269 communication. 271 Node identifier an opaque fixed-length identifier consisting of 272 DNCP_NODE_IDENTIFIER_LENGTH bytes which uniquely 273 identifies a DNCP node within a DNCP network. 275 Interface a node's attachment to a particular link. 277 Address an identifier used as source or destination of a 278 DNCP message flow, e.g., a tuple (IPv6 address, UDP 279 port) for an IPv6 UDP transport. 281 Endpoint a locally configured termination point for 282 (potential or established) DNCP message flows. An 283 endpoint is the source and destination for separate 284 unicast message flows to individual nodes and 285 optionally for multicast messages to all thereby 286 reachable nodes (e.g., for node discovery). 287 Endpoints are usually in one of the transport modes 288 specified in Section 4.2. 290 Endpoint a 32-bit opaque and locally unique value, which 291 identifier identifies a particular endpoint of a particular 292 DNCP node. The value 0 is reserved for DNCP and 293 DNCP-based protocol purposes and not used to 294 identify an actual endpoint. This definition is in 295 sync with the interface index definition in 296 [RFC3493], as the non-zero small positive integers 297 should comfortably fit within 32 bits. 299 Peer another DNCP node with which a DNCP node 300 communicates using at least one particular local 301 and remote endpoint pair. 303 Node data a set of TLVs published and owned by a node in the 304 DNCP network. Other nodes pass it along as-is, even 305 if they cannot fully interpret it. 307 Origination Time the (estimated) time when the node data set with 308 the current sequence number was published. 310 Node state a set of metadata attributes for node data. It 311 includes a sequence number for versioning, a hash 312 value for comparing equality of stored node data, 313 and a timestamp indicating the time passed since 314 its last publication (i.e., since the origination 315 time). The hash function and the length of the hash 316 value are defined in the DNCP profile. 318 Network state a hash value which represents the current state of 319 hash the network. The hash function and the length of 320 the hash value are defined in the DNCP profile. 321 Whenever a node is added, removed or updates its 322 published node data this hash value changes as 323 well. For calculation, please see Section 4.1. 325 Trust verdict a statement about the trustworthiness of a 326 certificate announced by a node participating in 327 the certificate based trust consensus mechanism. 329 Effective trust the trust verdict with the highest priority within 330 verdict the set of trust verdicts announced for the 331 certificate in the DNCP network. 333 Topology graph the undirected graph of DNCP nodes produced by 334 retaining only bidirectional peer relationships 335 between nodes. 337 Bidirectionally a peer is locally unidirectionally reachable if a 338 reachable consistent multicast or any unicast DNCP message 339 has been received by the local node (see Section 340 4.5). If said peer in return also considers the 341 local node unidirectionally reachable, then 342 bidirectionally reachability is established. As 343 this process is based on publishing peer 344 relationships and evaluating the resulting topology 345 graph as described in Section 4.6, this information 346 is available to the whole DNCP network. 348 Trickle Instance a distinct Trickle [RFC6206] algorithm state kept 349 by a node (Section 5) and related to an endpoint or 350 a particular (peer, endpoint) tuple with Trickle 351 variables I, t and c. See Section 4.3. 353 2.1. Requirements Language 355 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 356 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 357 "OPTIONAL" in this document are to be interpreted as described in RFC 358 2119 [RFC2119]. 360 3. Overview 362 DNCP operates primarily using unicast exchanges between nodes, and 363 may use multicast for Trickle-based shared state dissemination and 364 topology discovery. If used in pure unicast mode with unreliable 365 transport, Trickle is also used between peers. 367 DNCP is based on exchanging TLVs (Section 7) and defines a set of 368 mandatory and optional ones for its operation. They are categorized 369 into TLVs for requesting information (Section 7.1), transmitting data 370 (Section 7.2) and being published as data (Section 7.3). DNCP based 371 protocols usually specify additional ones to extend the capabilities. 373 DNCP discovers the topology of the nodes in the DNCP network and 374 maintains the liveliness of published node data by ensuring that the 375 publishing node is bidirectionally reachable. New potential peers 376 can be discovered autonomously on multicast-enabled links, their 377 addresses may be manually configured or they may be found by some 378 other means defined in the particular DNCP profile. The DNCP profile 379 may specify, for example, a well-known anycast address or 380 provisioning the remote address to contact via some other protocol 381 such as DHCPv6 [RFC3315]. 383 A hash tree of height 1, rooted in itself, is maintained by each node 384 to represent the state of all currently reachable nodes (see 385 Section 4.1) and the Trickle algorithm is used to trigger 386 synchronization (see Section 4.3). The need to check peer nodes for 387 state changes is thereby determined by comparing the current root of 388 their respective hash trees, i.e., their individually calculated 389 network state hashes. 391 Before joining a DNCP network, a node starts with a hash tree that 392 has only one leaf if the node publishes some TLVs, and no leaves 393 otherwise. It then announces the network state hash calculated from 394 the hash tree by means of the Trickle algorithm on all its configured 395 endpoints. 397 When an update is detected by a node (e.g., by receiving a different 398 network state hash from a peer) the originator of the event is 399 requested to provide a list of the state of all nodes, i.e., all the 400 information it uses to calculate its own hash tree. The node uses 401 the list to determine whether its own information is outdated and - 402 if necessary - requests the actual node data that has changed. 404 Whenever a node's local copy of any node data and its hash tree are 405 updated (e.g., due to its own or another node's node state changing 406 or due to a peer being added or removed) its Trickle instances are 407 reset which eventually causes any update to be propagated to all of 408 its peers. 410 4. Operation 412 4.1. Hash Tree 414 Each DNCP node maintains an arbitrary width hash tree of height 1. 415 The root of the tree represents the overall network state hash and is 416 used to determine whether the view of the network of two or more 417 nodes is consistent and shared. Each leaf represents one 418 bidirectionally reachable DNCP node. Every time a node is added or 419 removed from the topology graph (Section 4.6) it is likewise added or 420 removed as a leaf. At any time the leaves of the tree are ordered in 421 ascending order of the node identifiers of the nodes they represent. 423 4.1.1. Calculating network state and node data hashes 425 The network state hash and the node data hashes are calculated using 426 the hash function defined in the DNCP profile (Section 9) and 427 truncated to the number of bits specified therein. 429 Individual node data hashes are calculated by applying the function 430 and truncation on the respective node's node data as published in the 431 Node State TLV. Such node data sets are always ordered as defined in 432 Section 7.2.3. 434 The network state hash is calculated by applying the function and 435 truncation on the concatenated network state. This state is formed 436 by first concatenating each node's sequence number (in network byte 437 order) with its node data hash to form a per-node datum for each 438 node. These per-node data are then concatenated in ascending order 439 of the respective node's node identifier, i.e., in the order that the 440 nodes appear in the hash tree. 442 4.1.2. Updating network state and node data hashes 444 The network state hash and the node data hashes are updated on-demand 445 and whenever any locally stored per-node state changes. This 446 includes local unidirectional reachability encoded in the published 447 Peer TLVs (Section 7.3.1) and - when combined with remote data - 448 results in awareness of bidirectional reachability changes. 450 4.2. Data Transport 452 DNCP has few requirements for the underlying transport; it requires 453 some way of transmitting either unicast datagram or stream data to a 454 peer and, if used in multicast mode, a way of sending multicast 455 datagrams. As multicast is used only to identify potential new DNCP 456 nodes and to send status messages which merely notify that a unicast 457 exchange should be triggered, the multicast transport does not have 458 to be secured. If unicast security is desired and one of the built- 459 in security methods is to be used, support for some TLS-derived 460 transport scheme - such as TLS [RFC5246] on top of TCP or DTLS 461 [RFC6347] on top of UDP - is also required. They provide for 462 integrity protection and confidentiality of the node data, as well as 463 authentication and authorization using the schemes defined in 464 Security and Trust Management (Section 8). A specific definition of 465 the transport(s) in use and their parameters MUST be provided by the 466 DNCP profile. 468 TLVs (Section 7) are sent across the transport as is, and they SHOULD 469 be sent together where, e.g., MTU considerations do not recommend 470 sending them in multiple batches. DNCP does not fragment or 471 reassemble TLVs thus it MUST be ensured that the underlying transport 472 performs these operations should they be necessary. If this document 473 indicates sending one or more TLVs, then the sending node does not 474 need to keep track of the packets sent after handing them over to the 475 respective transport, i.e., reliable DNCP operation is ensured merely 476 by the explicitly defined timers and state machines such as Trickle 477 (Section 4.3). TLVs in general are handled individually and 478 statelessly (and thus do not need to be sent in any particular order) 479 with one exception: To form bidirectional peer relationships DNCP 480 requires identification of the endpoints used for communication. As 481 bidirectional peer relationships are required for validating 482 liveliness of published node data as described in Section 4.6, a DNCP 483 node MUST send a Node Endpoint TLV (Section 7.2.1). When it is sent 484 varies, depending on the underlying transport, but conceptually it 485 should be available whenever processing a Network State TLV: 487 o If using a stream transport, the TLV MUST be sent at least once 488 per connection, but SHOULD NOT be sent more than once. 490 o If using a datagram transport, it MUST be included in every 491 datagram that also contains a Network State TLV (Section 7.2.2) 492 and MUST be located before any such TLV. It SHOULD also be 493 included in any other datagram, to speed up initial peer 494 detection. 496 Given the assorted transport options as well as potential endpoint 497 configuration, a DNCP endpoint may be used in various transport 498 modes: 500 Unicast: 502 * If only reliable unicast transport is used, Trickle is not used 503 at all. Whenever the locally calculated network state hash 504 changes, a single Network State TLV (Section 7.2.2) is sent to 505 every unicast peer. Additionally, recently changed Node State 506 TLVs (Section 7.2.3) MAY be included. 508 * If only unreliable unicast transport is used, Trickle state is 509 kept per peer and it is used to send Network State TLVs 510 intermittently, as specified in Section 4.3. 512 Multicast+Unicast: If multicast datagram transport is available on 513 an endpoint, Trickle state is only maintained for the endpoint as 514 a whole. It is used to send Network State TLVs periodically, as 515 specified in Section 4.3. Additionally, per-endpoint keep-alives 516 MAY be defined in the DNCP profile, as specified in Section 6.1.2. 518 MulticastListen+Unicast: Just like Unicast, except multicast 519 transmissions are listened to in order to detect changes of the 520 highest node identifier. This mode is used only if the DNCP 521 profile supports dense multicast-enabled link optimization 522 (Section 6.2). 524 4.3. Trickle-Driven Status Updates 526 The Trickle algorithm [RFC6206] is used to ensure protocol 527 reliability over unreliable multicast or unicast transports. For 528 reliable unicast transports, its actual algorithm is unnecessary and 529 omitted (Section 4.2). DNCP maintains multiple Trickle states as 530 defined in Section 5. Each such state can be based on different 531 parameters (see below) and is responsible for ensuring that a 532 specific peer or all peers on the respective endpoint are regularly 533 provided with the node's current locally calculated network state 534 hash for state comparison, i.e., to detect potential divergence in 535 the perceived network state. 537 Trickle defines 3 parameters: Imin, Imax and k. Imin and Imax 538 represent the minimum value for I and the maximum number of doublings 539 of Imin, where I is the time interval during which at least k Trickle 540 updates must be seen on an endpoint to prevent local state 541 transmission. The actual suggested Trickle algorithm parameters are 542 DNCP profile specific, as described in Section 9. 544 The Trickle state for all Trickle instances defined in Section 5 is 545 considered inconsistent and reset if and only if the locally 546 calculated network state hash changes. This occurs either due to a 547 change in the local node's own node data, or due to receipt of more 548 recent data from another node as explained in Section 4.1. A node 549 MUST NOT reset its Trickle state merely based on receiving a Network 550 State TLV (Section 7.2.2) with a network state hash which is 551 different from its locally calculated one. 553 Every time a particular Trickle instance indicates that an update 554 should be sent, the node MUST send a Network State TLV 555 (Section 7.2.2) if and only if: 557 o the endpoint is in Multicast+Unicast transport mode, in which case 558 the TLV MUST be sent over multicast. 560 o the endpoint is NOT in Multicast+Unicast transport mode, and the 561 unicast transport is unreliable, in which case the TLV MUST be 562 sent over unicast. 564 A (sub)set of all Node State TLVs (Section 7.2.3) MAY also be 565 included, unless it is defined as undesirable for some reason by the 566 DNCP profile, or to avoid exposure of the node state TLVs by 567 transmitting them within insecure multicast when using secure 568 unicast. 570 4.4. Processing of Received TLVs 572 This section describes how received TLVs are processed. The DNCP 573 profile may specify when to ignore particular TLVs, e.g., to modify 574 security properties - see Section 9 for what may be safely defined to 575 be ignored in a profile. Any 'reply' mentioned in the steps below 576 denotes sending of the specified TLV(s) to the originator of the TLV 577 being processed. All such replies MUST be sent using unicast. If 578 the TLV being replied to was received via multicast and it was sent 579 to a multiple access link, the reply MUST be delayed by a random 580 timespan in [0, Imin/2], to avoid potential simultaneous replies that 581 may cause problems on some links, unless specified differently in the 582 DNCP profile. Sending of replies MAY also be rate-limited or omitted 583 for a short period of time by an implementation. However, if the TLV 584 is not forbidden by the DNCP profile, an implementation MUST reply to 585 retransmissions of the TLV with a non-zero probability to avoid 586 starvation which would break the state synchronization. 588 A DNCP node MUST process TLVs received from any valid (e.g., 589 correctly scoped) address, as specified by the DNCP profile and the 590 configuration of a particular endpoint, whether this address is known 591 to be the address of a peer or not. This provision satisfies the 592 needs of monitoring or other host software that needs to discover the 593 DNCP topology without adding to the state in the network. 595 Upon receipt of: 597 o Request Network State TLV (Section 7.1.1): The receiver MUST reply 598 with a Network State TLV (Section 7.2.2) and a Node State TLV 599 (Section 7.2.3) for each node data used to calculate the network 600 state hash. The Node State TLVs SHOULD NOT contain the optional 601 node data part to avoid redundant transmission of node data, 602 unless explicitly specified in the DNCP profile. 604 o Request Node State TLV (Section 7.1.2): If the receiver has node 605 data for the corresponding node, it MUST reply with a Node State 606 TLV (Section 7.2.3) for the corresponding node. The optional node 607 data part MUST be included in the TLV. 609 o Network State TLV (Section 7.2.2): If the network state hash 610 differs from the locally calculated network state hash, and the 611 receiver is unaware of any particular node state differences with 612 the sender, the receiver MUST reply with a Request Network State 613 TLV (Section 7.1.1). These replies MUST be rate limited to only 614 at most one reply per link per unique network state hash within 615 Imin. The simplest way to ensure this rate limit is a timestamp 616 indicating requests, and sending at most one Request Network State 617 TLV (Section 7.1.1) per Imin. To facilitate faster state 618 synchronization, if a Request Network State TLV is sent in a 619 reply, a local, current Network State TLV MAY also be sent. 621 o Node State TLV (Section 7.2.3): 623 * If the node identifier matches the local node identifier and 624 the TLV has a greater sequence number than its current local 625 value, or the same sequence number and a different hash, the 626 node SHOULD re-publish its own node data with a sequence number 627 significantly (e.g., 1000) greater than the received one, to 628 reclaim the node identifier. This difference is needed in 629 order to ensure that it is higher than any potentially 630 lingering copies of the node state in the network. This may 631 occur normally once due to the local node restarting and not 632 storing the most recently used sequence number. If this occurs 633 more than once or for nodes not re-publishing their own node 634 data, the DNCP profile MUST provide guidance on how to handle 635 these situations as it indicates the existence of another 636 active node with the same node identifier. 638 * If the node identifier does not match the local node 639 identifier, and one or more of the following conditions are 640 true: 642 + The local information is outdated for the corresponding node 643 (local sequence number is less than that within the TLV). 645 + The local information is potentially incorrect (local 646 sequence number matches but the node data hash differs). 648 + There is no data for that node altogether. 650 Then: 652 + If the TLV contains the Node Data field, it SHOULD also be 653 verified by ensuring that the locally calculated hash of the 654 Node Data matches the content of the H(Node Data) field 655 within the TLV. If they differ, the TLV SHOULD be ignored 656 and not processed further. 658 + If the TLV does not contain the Node Data field, and the 659 H(Node Data) field within the TLV differs from the local 660 node data hash for that node (or there is none), the 661 receiver MUST reply with a Request Node State TLV 662 (Section 7.1.2) for the corresponding node. 664 + Otherwise the receiver MUST update its locally stored state 665 for that node (node data based on Node Data field if 666 present, sequence number and relative time) to match the 667 received TLV. 669 For comparison purposes of the sequence number, a looping 670 comparison function MUST be used to avoid problems in case of 671 overflow. The comparison function a < b <=> ((a - b) % (2^32)) & 672 (2^31) != 0 where (a % b) represents the remainder of a modulo b 673 and (a & b) represents bitwise conjunction of a and b is 674 RECOMMENDED unless the DNCP profile defines another. 676 o Any other TLV: TLVs not recognized by the receiver MUST be 677 silently ignored unless they are sent within another TLV (for 678 example, TLVs within the Node Data field of a Node State TLV). 679 TLVs within the Node Data field of the Node State TLV not 680 recognized by the receiver MUST be retained for distribution to 681 other nodes and for calculating the node data hash as described in 682 Section 7.2.3 but are ignored for other purposes. 684 If secure unicast transport is configured for an endpoint, any Node 685 State TLVs received over insecure multicast MUST be silently ignored. 687 4.5. Discovering, Adding and Removing Peers 689 Peer relations are established between neighbors using one or more 690 mutually connected endpoints. Such neighbors exchange information 691 about network state and published data directly and through 692 transitivity this information then propagates throughout the network. 694 New peers are discovered using the regular unicast or multicast 695 transport defined in the DNCP profile (Section 9). This process is 696 not distinguished from peer addition, i.e., an unknown peer is simply 697 discovered by receiving regular DNCP protocol TLVs from it and 698 dedicated discovery messages or TLVs do not exist. For unicast-only 699 transports, the individual node's transport addresses are 700 preconfigured or obtained using an external service discovery 701 protocol. In the presence of a multicast transport, messages from 702 unknown peers are handled in the same way as multicast messages from 703 peers that are already known, thus new peers are simply discovered 704 when sending their regular DNCP protocol TLVs using multicast. 706 When receiving a Node Endpoint TLV (Section 7.2.1) on an endpoint 707 from an unknown peer: 709 o If received over unicast, the remote node MUST be added as a peer 710 on the endpoint and a Peer TLV (Section 7.3.1) MUST be created for 711 it. 713 o If received over multicast, the node MAY be sent a (possibly rate- 714 limited) unicast Request Network State TLV (Section 7.1.1). 716 If keep-alives specified in Section 6.1 are NOT sent by the peer 717 (either the DNCP profile does not specify the use of keep-alives or 718 the particular peer chooses not to send keep-alives), some other 719 existing local transport-specific means (such as Ethernet carrier- 720 detection or TCP keep-alive) MUST be used to ensure its presence. If 721 the peer does not send keep-alives, and no means to verify presence 722 of the peer are available, the peer MUST be considered no longer 723 present and it SHOULD NOT be added back as a peer until it starts 724 sending keep-alives again. When the peer is no longer present, the 725 Peer TLV and the local DNCP peer state MUST be removed. DNCP does 726 not define an explicit message or TLV for indicating the termination 727 of DNCP operation by the terminating node, however a derived protocol 728 could specify an extension, if the need arises. 730 If the local endpoint is in the Multicast-Listen+Unicast transport 731 mode, a Peer TLV (Section 7.3.1) MUST NOT be published for the peers 732 not having the highest node identifier. 734 4.6. Data Liveliness Validation 736 Maintenance of the hash tree (Section 4.1) and thereby network state 737 hash updates depend on up-to-date information on bidirectional node 738 reachability derived from the contents of a topology graph. This 739 graph changes whenever nodes are added to or removed from the network 740 or when bidirectional connectivity between existing nodes is 741 established or lost. Therefore the graph MUST be updated either 742 immediately or with a small delay shorter than the DNCP profile- 743 defined Trickle Imin, whenever: 745 o A Peer TLV or a whole node is added or removed, or 747 o the origination time (in milliseconds) of some node's node data is 748 less than current time - 2^32 + 2^15. 750 The artificial upper limit for the origination time is used to 751 gracefully avoid overflows of the origination time and allow for the 752 node to republish its data as noted in Section 7.2.3. 754 The topology graph update starts with the local node marked as 755 reachable and all other nodes marked as unreachable. Other nodes are 756 then iteratively marked as reachable using the following algorithm: A 757 candidate not-yet-reachable node N with an endpoint NE is marked as 758 reachable if there is a reachable node R with an endpoint RE that 759 meet all of the following criteria: 761 o The origination time (in milliseconds) of R's node data is greater 762 than current time - 2^32 + 2^15. 764 o R publishes a Peer TLV with: 766 * Peer Node Identifier = N's node identifier 768 * Peer Endpoint Identifier = NE's endpoint identifier 769 * Endpoint Identifier = RE's endpoint identifier 771 o N publishes a Peer TLV with: 773 * Peer Node Identifier = R's node identifier 775 * Peer Endpoint Identifier = RE's endpoint identifier 777 * Endpoint Identifier = NE's endpoint identifier 779 The algorithm terminates, when no more candidate nodes fulfilling 780 these criteria can be found. 782 DNCP nodes that have not been reachable in the most recent topology 783 graph traversal MUST NOT be used for calculation of the network state 784 hash, be provided to any applications that need to use the whole TLV 785 graph, or be provided to remote nodes. They MAY be forgotten 786 immediately after the topology graph traversal, however it is 787 RECOMMENDED to keep them at least briefly to improve the speed of 788 DNCP network state convergence. This reduces the number of queries 789 needed to reconverge during both initial network convergence and when 790 a part of the network loses and regains bidirectional connectivity 791 within that time period. 793 5. Data Model 795 This section describes the local data structures a minimal 796 implementation might use. This section is provided only as a 797 convenience for the implementor. Some of the optional extensions 798 (Section 6) describe additional data requirements, and some optional 799 parts of the core protocol may also require more. 801 A DNCP node has: 803 o A data structure containing data about the most recently sent 804 Request Network State TLVs (Section 7.1.1). The simplest option 805 is keeping a timestamp of the most recent request (required to 806 fulfill reply rate limiting specified in Section 4.4). 808 A DNCP node has for every DNCP node in the DNCP network: 810 o Node identifier: the unique identifier of the node. The length, 811 how it is produced, and how collisions are handled, is up to the 812 DNCP profile. 814 o Node data: the set of TLV tuples published by that particular 815 node. As they are transmitted ordered (see Node State TLV 816 (Section 7.2.3) for details), maintaining the order within the 817 data structure here may be reasonable. 819 o Latest sequence number: the 32-bit sequence number that is 820 incremented any time the TLV set is published. The comparison 821 function used to compare them is described in Section 4.4. 823 o Origination time: the (estimated) time when the current TLV set 824 with the current sequence number was published. It is used to 825 populate the Milliseconds Since Origination field in a Node State 826 TLV (Section 7.2.3). Ideally it also has millisecond accuracy. 828 Additionally, a DNCP node has a set of endpoints for which DNCP is 829 configured to be used. For each such endpoint, a node has: 831 o Endpoint identifier: the 32-bit opaque locally unique value 832 identifying the endpoint within a node. It SHOULD NOT be reused 833 immediately after an endpoint is disabled. 835 o Trickle instance: the endpoint's Trickle instance with parameters 836 I, T, and c (only on an endpoint in Multicast+Unicast transport 837 mode). 839 and one (or more) of the following: 841 o Interface: the assigned local network interface. 843 o Unicast address: the DNCP node it should connect with. 845 o Set of addresses: the DNCP nodes from which connections are 846 accepted. 848 For each remote (peer, endpoint) pair detected on a local endpoint, a 849 DNCP node has: 851 o Node identifier: the unique identifier of the peer. 853 o Endpoint identifier: the unique endpoint identifier used by the 854 peer. 856 o Peer address: the most recently used address of the peer 857 (authenticated and authorized, if security is enabled). 859 o Trickle instance: the particular peer's Trickle instance with 860 parameters I, T, and c (only on an endpoint in Unicast mode, when 861 using an unreliable unicast transport) . 863 6. Optional Extensions 865 This section specifies extensions to the core protocol that a DNCP 866 profile may specify to be used. 868 6.1. Keep-Alives 870 While DNCP provides mechanisms for discovery and adding of new peers 871 on an endpoint (Section 4.5), as well as state change notifications, 872 another mechanism may be needed to get rid of old, no longer valid 873 peers if the transport or lower layers do not provide one as noted in 874 Section 4.6. 876 If keep-alives are not specified in the DNCP profile, the rest of 877 this subsection MUST be ignored. 879 A DNCP profile MAY specify either per-endpoint (sent using multicast 880 to all DNCP nodes connected to a multicast-enabled link) or per-peer 881 (sent using unicast to each peer individually) keep-alive support. 883 For every endpoint that a keep-alive is specified for in the DNCP 884 profile, the endpoint-specific keep-alive interval MUST be 885 maintained. By default, it is DNCP_KEEPALIVE_INTERVAL. If there is 886 a local value that is preferred for that for any reason 887 (configuration, energy conservation, media type, ..), it can be 888 substituted instead. If a non-default keep-alive interval is used on 889 any endpoint, a DNCP node MUST publish appropriate Keep-Alive 890 Interval TLV(s) (Section 7.3.2) within its node data. 892 6.1.1. Data Model Additions 894 The following additions to the Data Model (Section 5) are needed to 895 support keep-alives: 897 For each configured endpoint that has per-endpoint keep-alives 898 enabled: 900 o Last sent: If a timestamp which indicates the last time a Network 901 State TLV (Section 7.2.2) was sent over that interface. 903 For each remote (peer, endpoint) pair detected on a local endpoint, a 904 DNCP node has: 906 o Last contact timestamp: a timestamp which indicates the last time 907 a consistent Network State TLV (Section 7.2.2) was received from 908 the peer over multicast, or anything was received over unicast. 909 Failing to update it for a certain amount of time as specified in 910 Section 6.1.5 results in the removal of the peer. When adding a 911 new peer, it is initialized to the current time. 913 o Last sent: If per-peer keep-alives are enabled, a timestamp which 914 indicates the last time a Network State TLV (Section 7.2.2) was 915 sent to to that point-to-point peer. When adding a new peer, it 916 is initialized to the current time. 918 6.1.2. Per-Endpoint Periodic Keep-Alives 920 If per-endpoint keep-alives are enabled on an endpoint in 921 Multicast+Unicast transport mode, and if no traffic containing a 922 Network State TLV (Section 7.2.2) has been sent to a particular 923 endpoint within the endpoint-specific keep-alive interval, a Network 924 State TLV (Section 7.2.2) MUST be sent on that endpoint, and a new 925 Trickle interval started, as specified in the step 2 of Section 4.2 926 of [RFC6206]. The actual sending time SHOULD be further delayed by a 927 random timespan in [0, Imin/2]. 929 6.1.3. Per-Peer Periodic Keep-Alives 931 If per-peer keep-alives are enabled on a unicast-only endpoint, and 932 if no traffic containing a Network State TLV (Section 7.2.2) has been 933 sent to a particular peer within the endpoint-specific keep-alive 934 interval, a Network State TLV (Section 7.2.2) MUST be sent to the 935 peer, and a new Trickle interval started, as specified in the step 2 936 of Section 4.2 of [RFC6206]. 938 6.1.4. Received TLV Processing Additions 940 If a TLV is received over unicast from the peer, the Last contact 941 timestamp for the peer MUST be updated. 943 On receipt of a Network State TLV (Section 7.2.2) which is consistent 944 with the locally calculated network state hash, the Last contact 945 timestamp for the peer MUST be updated in order to maintain it as a 946 peer. 948 6.1.5. Peer Removal 950 For every peer on every endpoint, the endpoint-specific keep-alive 951 interval must be calculated by looking for Keep-Alive Interval TLVs 952 (Section 7.3.2) published by the node, and if none exist, using the 953 default value of DNCP_KEEPALIVE_INTERVAL. If the peer's Last contact 954 timestamp has not been updated for at least locally chosen 955 potentially endpoint-specific keep-alive multiplier (defaults to 956 DNCP_KEEPALIVE_MULTIPLIER) times the peer's endpoint-specific keep- 957 alive interval, the Peer TLV for that peer and the local DNCP peer 958 state MUST be removed. 960 6.2. Support For Dense Multicast-Enabled Links 962 This optimization is needed to avoid a state space explosion. Given 963 a large set of DNCP nodes publishing data on an endpoint that uses 964 multicast on a link, every node will add a Peer TLV (Section 7.3.1) 965 for each peer. While Trickle limits the amount of traffic on the 966 link in stable state to some extent, the total amount of data that is 967 added to and maintained in the DNCP network given N nodes on a 968 multicast-enabled link is O(N^2). Additionally if per-peer keep- 969 alives are used, there will be O(N^2) keep-alives running on the link 970 if liveliness of peers is not ensured using some other way (e.g., TCP 971 connection lifetime, layer 2 notification, per-endpoint keep-alive). 973 An upper bound for the number of peers that are allowed for a 974 particular type of link that an endpoint in Multicast+Unicast 975 transport mode is used on SHOULD be provided by a DNCP profile, but 976 MAY also be chosen at runtime. The main consideration when selecting 977 a bound (if any) for a particular type of link should be whether it 978 supports multicast traffic, and whether a too large number of peers 979 case is likely to happen during the use of that DNCP profile on that 980 particular type of link. If neither is likely, there is little point 981 specifying support for this for that particular link type. 983 If a DNCP profile does not support this extension at all, the rest of 984 this subsection MUST be ignored. This is because when this extension 985 is used, the state within the DNCP network only contains a subset of 986 the full topology of the network. Therefore every node must be aware 987 of the potential of it being used in a particular DNCP profile. 989 If the specified upper bound is exceeded for some endpoint in 990 Multicast+Unicast transport mode and if the node does not have the 991 highest node identifier on the link, it SHOULD treat the endpoint as 992 a unicast endpoint connected to the node that has the highest node 993 identifier detected on the link, therefore transitioning to 994 Multicast-listen+Unicast transport mode. See Section 4.2 for 995 implications on the specific endpoint behavior. The nodes in 996 Multicast-listen+Unicast transport mode MUST keep listening to 997 multicast traffic to both receive messages from the node(s) still in 998 Multicast+Unicast mode, and as well to react to nodes with a greater 999 node identifier appearing. If the highest node identifier present on 1000 the link changes, the remote unicast address of the endpoints in 1001 Multicast-Listen+Unicast transport mode MUST be changed. If the node 1002 identifier of the local node is the highest one, the node MUST switch 1003 back to, or stay in Multicast+Unicast mode, and form peer 1004 relationships with all peers as specified in Section 4.5. 1006 7. Type-Length-Value Objects 1008 0 1 2 3 1009 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 1010 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1011 | Type | Length | 1012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1013 | Value (if any) (+padding (if any)) | 1014 .. 1015 | (variable # of bytes) | 1016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1017 | (Optional nested TLVs) | 1018 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1020 Each TLV is encoded as: 1022 o a 2 byte Type field 1024 o a 2 byte Length field which contains the length of the Value field 1025 in bytes; 0 means no Value 1027 o the Value itself (if any) 1029 o padding bytes with value of zero up to the next 4 byte boundary if 1030 the Length is not divisible by 4. 1032 While padding bytes MUST NOT be included in the number stored in the 1033 Length field of the TLV, if the TLV is enclosed within another TLV, 1034 then the padding is included in the enclosing TLV's Length value. 1036 Each TLV which does not define optional fields or variable-length 1037 content MAY be sent with additional sub-TLVs appended after the TLV 1038 to allow for extensibility. When handling such TLV types, each node 1039 MUST accept received TLVs that are longer than the fixed fields 1040 specified for the particular type, and ignore the sub-TLVs with 1041 either unknown types, or not supported within that particular TLV 1042 type. If any sub-TLVs are present, the Length field of the TLV 1043 describes the number of bytes from the first byte of the TLV's own 1044 Value (if any) to the last (padding) byte of the last sub-TLV. 1046 For example, type=123 (0x7b) TLV with value 'x' (120 = 0x78) is 1047 encoded as: 007B 0001 7800 0000. If it were to have sub-TLV of 1048 type=124 (0x7c) with value 'y', it would be encoded as 007B 000C 7800 1049 0000 007C 0001 7900 0000. 1051 In this section, the following special notation is used: 1053 .. = octet string concatenation operation. 1055 H(x) = non-cryptographic hash function specified by DNCP profile. 1057 7.1. Request TLVs 1059 7.1.1. Request Network State TLV 1061 0 1 2 3 1062 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 1063 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1064 | Type: REQ-NETWORK-STATE (1) | Length: >= 0 | 1065 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1067 This TLV is used to request response with a Network State TLV 1068 (Section 7.2.2) and all Node State TLVs (Section 7.2.3) (without node 1069 data). 1071 7.1.2. Request Node State TLV 1073 0 1 2 3 1074 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 1075 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1076 | Type: REQ-NODE-STATE (2) | Length: > 0 | 1077 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1078 | Node Identifier | 1079 | (length fixed in DNCP profile) | 1080 ... 1081 | | 1082 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1084 This TLV is used to request a Node State TLV (Section 7.2.3) 1085 (including node data) for the node with the matching node identifier. 1087 7.2. Data TLVs 1089 7.2.1. Node Endpoint TLV 1091 0 1 2 3 1092 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 1093 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1094 | Type: NODE-ENDPOINT (3) | Length: > 4 | 1095 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1096 | Node Identifier | 1097 | (length fixed in DNCP profile) | 1098 ... 1099 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1100 | Endpoint Identifier | 1101 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1102 This TLV identifies both the local node's node identifier, as well as 1103 the particular endpoint's endpoint identifier. Section 4.2 specifies 1104 when it is sent. 1106 7.2.2. Network State TLV 1108 0 1 2 3 1109 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 1110 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1111 | Type: NETWORK-STATE (4) | Length: > 0 | 1112 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1113 | H(sequence number of node 1 .. H(node data of node 1) .. | 1114 | .. sequence number of node N .. H(node data of node N)) | 1115 | (length fixed in DNCP profile) | 1116 ... 1117 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1119 This TLV contains the current network state hash calculated by its 1120 sender (Section 4.1 describes the algorithm). 1122 7.2.3. Node State TLV 1124 0 1 2 3 1125 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 1126 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1127 | Type: NODE-STATE (5) | Length: > 8 | 1128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1129 | Node Identifier | 1130 | (length fixed in DNCP profile) | 1131 ... 1132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1133 | Sequence Number | 1134 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1135 | Milliseconds Since Origination | 1136 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1137 | H(Node Data) | 1138 | (length fixed in DNCP profile) | 1139 ... 1140 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1141 | (optionally) Node Data (a set of nested TLVs) | 1142 ... 1143 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1145 This TLV represents the local node's knowledge about the published 1146 state of a node in the DNCP network identified by the Node Identifier 1147 field in the TLV. 1149 Every node, including the node publishing the node data, MUST update 1150 the Milliseconds Since Origination whenever it sends a Node State TLV 1151 based on when the node estimates the data was originally published. 1152 This is, e.g., to ensure that any relative timestamps contained 1153 within the published node data can be correctly offset and 1154 interpreted. Ultimately, what is provided is just an approximation, 1155 as transmission delays are not accounted for. 1157 Absent any changes, if the originating node notices that the 32-bit 1158 milliseconds since origination value would be close to overflow 1159 (greater than 2^32-2^16), the node MUST re-publish its TLVs even if 1160 there is no change. In other words, absent any other changes, the 1161 TLV set MUST be re-published roughly every 48 days. 1163 The actual node data of the node may be included within the TLV as 1164 well in the optional Node Data field. The set of TLVs MUST be 1165 strictly ordered based on ascending binary content (including TLV 1166 type and length). This enables, e.g., efficient state delta 1167 processing and no-copy indexing by TLV type by the recipient. The 1168 Node Data content MUST be passed along exactly as it was received. 1169 It SHOULD be also verified on receipt that the locally calculated 1170 H(Node Data) matches the content of the field within the TLV, and if 1171 the hash differs, the TLV SHOULD be ignored. 1173 7.3. Data TLVs within Node State TLV 1175 These TLVs are published by the DNCP nodes, and therefore only 1176 encoded in the Node Data field of Node State TLVs. If encountered 1177 outside Node State TLV, they MUST be silently ignored. 1179 7.3.1. Peer TLV 1181 0 1 2 3 1182 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 1183 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1184 | Type: PEER (8) | Length: > 8 | 1185 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1186 | Peer Node Identifier | 1187 | (length fixed in DNCP profile) | 1188 ... 1189 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1190 | Peer Endpoint Identifier | 1191 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1192 | (Local) Endpoint Identifier | 1193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1195 This TLV indicates that the node in question vouches that the 1196 specified peer is reachable by it on the specified local endpoint. 1198 The presence of this TLV at least guarantees that the node publishing 1199 it has received traffic from the peer recently. For guaranteed up- 1200 to-date bidirectional reachability, the existence of both nodes' 1201 matching Peer TLVs needs to be checked. 1203 7.3.2. Keep-Alive Interval TLV 1205 0 1 2 3 1206 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 1207 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1208 | Type: KEEP-ALIVE-INTERVAL (9) | Length: >= 8 | 1209 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1210 | Endpoint Identifier | 1211 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1212 | Interval | 1213 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1215 This TLV indicates a non-default interval being used to send keep- 1216 alives specified in Section 6.1. 1218 Endpoint identifier is used to identify the particular (local) 1219 endpoint for which the interval applies on the sending node. If 0, 1220 it applies for ALL endpoints for which no specific TLV exists. 1222 Interval specifies the interval in milliseconds at which the node 1223 sends keep-alives. A value of zero means no keep-alives are sent at 1224 all; in that case, some lower layer mechanism that ensures presence 1225 of nodes MUST be available and used. 1227 8. Security and Trust Management 1229 If specified in the DNCP profile, either DTLS [RFC6347] or TLS 1230 [RFC5246] may be used to authenticate and encrypt either some (if 1231 specified optional in the profile), or all unicast traffic. The 1232 following methods for establishing trust are defined, but it is up to 1233 the DNCP profile to specify which ones may, should or must be 1234 supported. 1236 8.1. Pre-Shared Key Based Trust Method 1238 A PSK-based trust model is a simple security management mechanism 1239 that allows an administrator to deploy devices to an existing network 1240 by configuring them with a pre-defined key, similar to the 1241 configuration of an administrator password or WPA-key. Although 1242 limited in nature it is useful to provide a user-friendly security 1243 mechanism for smaller networks. 1245 8.2. PKI Based Trust Method 1247 A PKI-based trust-model enables more advanced management capabilities 1248 at the cost of increased complexity and bootstrapping effort. It 1249 however allows trust to be managed in a centralized manner and is 1250 therefore useful for larger networks with a need for an authoritative 1251 trust management. 1253 8.3. Certificate Based Trust Consensus Method 1255 For some scenarios - such as bootstrapping a mostly unmanaged network 1256 - the methods described above may not provide a desirable tradeoff 1257 between security and user experience. This section includes guidance 1258 for implementing an opportunistic security [RFC7435] method which 1259 DNCP profiles can build upon and adapt for their specific 1260 requirements. 1262 The certificate-based consensus model is designed to be a compromise 1263 between trust management effort and flexibility. It is based on 1264 X.509-certificates and allows each DNCP node to provide a trust 1265 verdict on any other certificate and a consensus is found to 1266 determine whether a node using this certificate or any certificate 1267 signed by it is to be trusted. 1269 A DNCP node not using this security method MUST ignore all announced 1270 trust verdicts and MUST NOT announce any such verdicts by itself, 1271 i.e., any other normative language in this subsection does not apply 1272 to it. 1274 The current effective trust verdict for any certificate is defined as 1275 the one with the highest priority from all trust verdicts announced 1276 for said certificate at the time. 1278 8.3.1. Trust Verdicts 1280 Trust verdicts are statements of DNCP nodes about the trustworthiness 1281 of X.509-certificates. There are 5 possible trust verdicts in order 1282 of ascending priority: 1284 0 (Neutral): no trust verdict exists but the DNCP network should 1285 determine one. 1287 1 (Cached Trust): the last known effective trust verdict was 1288 Configured or Cached Trust. 1290 2 (Cached Distrust): the last known effective trust verdict was 1291 Configured or Cached Distrust. 1293 3 (Configured Trust): trustworthy based upon an external ceremony 1294 or configuration. 1296 4 (Configured Distrust): not trustworthy based upon an external 1297 ceremony or configuration. 1299 Trust verdicts are differentiated in 3 groups: 1301 o Configured verdicts are used to announce explicit trust verdicts a 1302 node has based on any external trust bootstrap or predefined 1303 relation a node has formed with a given certificate. 1305 o Cached verdicts are used to retain the last known trust state in 1306 case all nodes with configured verdicts about a given certificate 1307 have been disconnected or turned off. 1309 o The Neutral verdict is used to announce a new node intending to 1310 join the network so a final verdict for it can be found. 1312 The current effective trust verdict for any certificate is defined as 1313 the one with the highest priority within the set of trust verdicts 1314 announced for the certificate in the DNCP network. A node MUST be 1315 trusted for participating in the DNCP network if and only if the 1316 current effective trust verdict for its own certificate or any one in 1317 its certificate hierarchy is (Cached or Configured) Trust and none of 1318 the certificates in its hierarchy have an effective trust verdict of 1319 (Cached or Configured) Distrust. In case a node has a configured 1320 verdict, which is different from the current effective trust verdict 1321 for a certificate, the current effective trust verdict takes 1322 precedence in deciding trustworthiness. Despite that, the node still 1323 retains and announces its configured verdict. 1325 8.3.2. Trust Cache 1327 Each node SHOULD maintain a trust cache containing the current 1328 effective trust verdicts for all certificates currently announced in 1329 the DNCP network. This cache is used as a backup of the last known 1330 state in case there is no node announcing a configured verdict for a 1331 known certificate. It SHOULD be saved to a non-volatile memory at 1332 reasonable time intervals to survive a reboot or power outage. 1334 Every time a node (re)joins the network or detects the change of an 1335 effective trust verdict for any certificate, it will synchronize its 1336 cache, i.e., store new effective trust verdicts overwriting any 1337 previously cached verdicts. Configured verdicts are stored in the 1338 cache as their respective cached counterparts. Neutral verdicts are 1339 never stored and do not override existing cached verdicts. 1341 8.3.3. Announcement of Verdicts 1343 A node SHOULD always announce any configured trust verdicts it has 1344 established by itself, and it MUST do so if announcing the configured 1345 trust verdict leads to a change in the current effective trust 1346 verdict for the respective certificate. In absence of configured 1347 verdicts, it MUST announce cached trust verdicts it has stored in its 1348 trust cache, if one of the following conditions applies: 1350 o The stored trust verdict is Cached Trust and the current effective 1351 trust verdict for the certificate is Neutral or does not exist. 1353 o The stored trust verdict is Cached Distrust and the current 1354 effective trust verdict for the certificate is Cached Trust. 1356 A node rechecks these conditions whenever it detects changes of 1357 announced trust verdicts anywhere in the network. 1359 Upon encountering a node with a hierarchy of certificates for which 1360 there is no effective trust verdict, a node adds a Neutral Trust- 1361 Verdict-TLV to its node data for all certificates found in the 1362 hierarchy, and publishes it until an effective trust verdict 1363 different from Neutral can be found for any of the certificates, or a 1364 reasonable amount of time (10 minutes is suggested) with no reaction 1365 and no further authentication attempts has passed. Such trust 1366 verdicts SHOULD also be limited in rate and number to prevent denial- 1367 of-service attacks. 1369 Trust verdicts are announced using Trust-Verdict TLVs: 1371 0 1 2 3 1372 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 1373 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1374 | Type: Trust-Verdict (10) | Length: > 36 | 1375 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1376 | Verdict | (reserved) | 1377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1378 | | 1379 | | 1380 | | 1381 | SHA-256 Fingerprint | 1382 | | 1383 | | 1384 | | 1385 | | 1386 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1387 | Common Name | 1388 Verdict represents the numerical index of the trust verdict. 1390 (reserved) is reserved for future additions and MUST be set to 0 1391 when creating TLVs and ignored when parsing them. 1393 SHA-256 Fingerprint contains the SHA-256 [RFC6234] hash value of 1394 the certificate in DER-format. 1396 Common Name contains the variable-length (1-64 bytes) common name 1397 of the certificate. 1399 8.3.4. Bootstrap Ceremonies 1401 The following non-exhaustive list of methods describes possible ways 1402 to establish trust relationships between DNCP nodes and node 1403 certificates. Trust establishment is a two-way process in which the 1404 existing network must trust the newly added node and the newly added 1405 node must trust at least one of its peer nodes. It is therefore 1406 necessary that both the newly added node and an already trusted node 1407 perform such a ceremony to successfully introduce a node into the 1408 DNCP network. In all cases an administrator MUST be provided with 1409 external means to identify the node belonging to a certificate based 1410 on its fingerprint and a meaningful common name. 1412 8.3.4.1. Trust by Identification 1414 A node implementing certificate-based trust MUST provide an interface 1415 to retrieve the current set of effective trust verdicts, fingerprints 1416 and names of all certificates currently known and set configured 1417 trust verdicts to be announced. Alternatively it MAY provide a 1418 companion DNCP node or application with these capabilities with which 1419 it has a pre-established trust relationship. 1421 8.3.4.2. Preconfigured Trust 1423 A node MAY be preconfigured to trust a certain set of node or CA 1424 certificates. However such trust relationships MUST NOT result in 1425 unwanted or unrelated trust for nodes not intended to be run inside 1426 the same network (e.g., all other devices by the same manufacturer). 1428 8.3.4.3. Trust on Button Press 1430 A node MAY provide a physical or virtual interface to put one or more 1431 of its internal network interfaces temporarily into a mode in which 1432 it trusts the certificate of the first DNCP node it can successfully 1433 establish a connection with. 1435 8.3.4.4. Trust on First Use 1437 A node which is not associated with any other DNCP node MAY trust the 1438 certificate of the first DNCP node it can successfully establish a 1439 connection with. This method MUST NOT be used when the node has 1440 already associated with any other DNCP node. 1442 9. DNCP Profile-Specific Definitions 1444 Each DNCP profile MUST specify the following aspects: 1446 o Unicast and optionally multicast transport protocol(s) to be used. 1447 If multicast-based node and status discovery is desired, a 1448 datagram-based transport supporting multicast has to be available. 1450 o How the chosen transport(s) are secured: Not at all, optionally or 1451 always with the TLS scheme defined here using one or more of the 1452 methods, or with something else. If the links with DNCP nodes can 1453 be sufficiently secured or isolated, it is possible to run DNCP in 1454 a secure manner without using any form of authentication or 1455 encryption. 1457 o Transport protocols' parameters such as port numbers to be used, 1458 or multicast address to be used. Unicast, multicast, and secure 1459 unicast may each require different parameters, if applicable. 1461 o When receiving TLVs, what sort of TLVs are ignored in addition - 1462 as specified in Section 4.4 - e.g., for security reasons. While 1463 the security of the node data published within the Node State TLVs 1464 is already ensured by the base specification (if secure mode is 1465 enabled, Node State TLVs are sent only via unicast as multicast 1466 ones are ignored on receipt), if a profile adds TLVs that are sent 1467 outside the node data, a profile should indicate whether or not 1468 those TLVs should be ignored if they are received via multicast or 1469 non-secured unicast. A DNCP profile may define the following DNCP 1470 TLVs to be safely ignored: 1472 * Anything received over multicast, except Node Endpoint TLV 1473 (Section 7.2.1) and Network State TLV (Section 7.2.2). 1475 * Any TLVs received over unreliable unicast or multicast at too 1476 high rate; Trickle will ensure eventual convergence given the 1477 rate slows down at some point. 1479 o How to deal with node identifier collision as described in 1480 Section 4.4. Main options are either for one or both nodes to 1481 assign new node identifiers to themselves, or to notify someone 1482 about a fatal error condition in the DNCP network. 1484 o Imin, Imax and k ranges to be suggested for implementations to be 1485 used in the Trickle algorithm. The Trickle algorithm does not 1486 require these to be the same across all implementations for it to 1487 work, but similar orders of magnitude helps implementations of a 1488 DNCP profile to behave more consistently and to facilitate 1489 estimation of lower and upper bounds for convergence behavior of 1490 the network. 1492 o Hash function H(x) to be used, and how many bits of the output are 1493 actually used. The chosen hash function is used to handle both 1494 hashing of node data, and to produce network state hash, which is 1495 a hash of node data hashes. SHA-256 defined in [RFC6234] is the 1496 recommended default choice, but a non-cryptographic hash function 1497 could be used as well. If there is a hash collision in the 1498 network state hash, the network will effectively be partitioned to 1499 partitions that believe that they are up to date, but actually no 1500 longer converged. The network will converge either when some node 1501 data anywhere in the network changes, or when conflicting Node 1502 State TLVs get transmitted across the partition (either caused by 1503 Trickle-Driven Status Updates (Section 4.3) or as part of the 1504 Processing of Received TLVs (Section 4.4)). If a node publishes 1505 node data with a hash that collides with any previously published 1506 node data, the update may not be (fully) propagated and the old 1507 version of node data may be used instead. 1509 o DNCP_NODE_IDENTIFIER_LENGTH: The fixed length of a node identifier 1510 (in bytes). 1512 o Whether to send keep-alives, and if so, whether per-endpoint 1513 (requires multicast transport), or per-peer. Keep-alive has also 1514 associated parameters: 1516 * DNCP_KEEPALIVE_INTERVAL: How often keep-alives are to be sent 1517 by default (if enabled). 1519 * DNCP_KEEPALIVE_MULTIPLIER: How many times the 1520 DNCP_KEEPALIVE_INTERVAL (or peer-supplied keep-alive interval 1521 value) a node may not be heard from to be considered still 1522 valid. This is just a default used in absence of any other 1523 configuration information, or particular per-endpoint 1524 configuration. 1526 o Whether to support dense multicast-enabled link optimization 1527 (Section 6.2) or not. 1529 For some guidance on choosing transport and security options, please 1530 see Appendix B. 1532 10. Security Considerations 1534 DNCP-based protocols may use multicast to indicate DNCP state changes 1535 and for keep-alive purposes. However, no actual published data TLVs 1536 will be sent across that channel. Therefore an attacker may only 1537 learn hash values of the state within DNCP and may be able to trigger 1538 unicast synchronization attempts between nodes on a local link this 1539 way. A DNCP node MUST therefore rate-limit its reactions to 1540 multicast packets. 1542 When using DNCP to bootstrap a network, PKI based solutions may have 1543 issues when validating certificates due to potentially unavailable 1544 accurate time, or due to inability to use the network to either check 1545 Certificate Revocation Lists or perform on-line validation. 1547 The Certificate-based trust consensus mechanism defined in this 1548 document allows for a consenting revocation, however in case of a 1549 compromised device the trust cache may be poisoned before the actual 1550 revocation happens allowing the distrusted device to rejoin the 1551 network using a different identity. Stopping such an attack might 1552 require physical intervention and flushing of the trust caches. 1554 11. IANA Considerations 1556 IANA should set up a registry for the (decimal 16-bit) "DNCP TLV 1557 Types" under "Distributed Node Consensus Protocol (DNCP)", with the 1558 following initial contents: ([RFC Editor: please remove] ideally as 1559 http://www.iana.org/assignments/dncp-registry) 1561 0: Reserved 1563 1: Request network state 1565 2: Request node state 1567 3: Node endpoint 1569 4: Network state 1571 5: Node state 1573 6: Reserved (was: Custom) 1575 7: Reserved (was: Fragment count) 1577 8: Peer 1579 9: Keep-alive interval 1580 10: Trust-Verdict 1582 11-31: Free - policy of standards action [RFC5226] should be used 1584 32-511: Reserved for per-DNCP profile use 1586 512-767: Free - policy of standards action [RFC5226] should be 1587 used 1589 768-1023: Private use [RFC5226] 1591 1024-65535: Reserved for future protocol evolution (for example, 1592 DNCP version 2) 1594 12. References 1596 12.1. Normative references 1598 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1599 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 1600 RFC2119, March 1997, 1601 . 1603 [RFC6206] Levis, P., Clausen, T., Hui, J., Gnawali, O., and J. Ko, 1604 "The Trickle Algorithm", RFC 6206, DOI 10.17487/RFC6206, 1605 March 2011, . 1607 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 1608 (SHA and SHA-based HMAC and HKDF)", RFC 6234, DOI 1609 10.17487/RFC6234, May 2011, 1610 . 1612 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1613 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1614 DOI 10.17487/RFC5226, May 2008, 1615 . 1617 12.2. Informative references 1619 [RFC3493] Gilligan, R., Thomson, S., Bound, J., McCann, J., and W. 1620 Stevens, "Basic Socket Interface Extensions for IPv6", RFC 1621 3493, DOI 10.17487/RFC3493, February 2003, 1622 . 1624 [RFC3315] Droms, R., Ed., Bound, J., Volz, B., Lemon, T., Perkins, 1625 C., and M. Carney, "Dynamic Host Configuration Protocol 1626 for IPv6 (DHCPv6)", RFC 3315, DOI 10.17487/RFC3315, July 1627 2003, . 1629 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 1630 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 1631 January 2012, . 1633 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1634 (TLS) Protocol Version 1.2", RFC 5246, DOI 10.17487/ 1635 RFC5246, August 2008, 1636 . 1638 [RFC7435] Dukhovni, V., "Opportunistic Security: Some Protection 1639 Most of the Time", RFC 7435, DOI 10.17487/RFC7435, 1640 December 2014, . 1642 [I-D.ietf-homenet-prefix-assignment] 1643 Pfister, P., Paterson, B., and J. Arkko, "Distributed 1644 Prefix Assignment Algorithm", draft-ietf-homenet-prefix- 1645 assignment-08 (work in progress), August 2015. 1647 Appendix A. Alternative Modes of Operation 1649 Beyond what is described in the main text, the protocol allows for 1650 other uses. These are provided as examples. 1652 A.1. Read-only Operation 1654 If a node uses just a single endpoint and does not need to publish 1655 any TLVs, full DNCP node functionality is not required. Such limited 1656 node can acquire and maintain view of the TLV space by implementing 1657 the processing logic as specified in Section 4.4. Such node would 1658 not need Trickle, peer-maintenance or even keep-alives at all, as the 1659 DNCP nodes' use of it would guarantee eventual receipt of network 1660 state hashes, and synchronization of node data, even in presence of 1661 unreliable transport. 1663 A.2. Forwarding Operation 1665 If a node with a pair of endpoints does not need to publish any TLVs, 1666 it can detect (for example) nodes with the highest node identifier on 1667 each of the endpoints (if any). Any TLVs received from one of them 1668 would be forwarded verbatim as unicast to the other node with highest 1669 node identifier. 1671 Any tinkering with the TLVs would remove guarantees of this scheme 1672 working; however passive monitoring would obviously be fine. This 1673 type of simple forwarding cannot be chained, as it does not send 1674 anything proactively. 1676 Appendix B. DNCP Profile Additional Guidance 1678 This appendix explains implications of design choices made when 1679 specifying DNCP profile to use particular transport or security 1680 options. 1682 B.1. Unicast Transport - UDP or TCP? 1684 The node data published by a DNCP node is limited to 64KB due to the 1685 16-bit size of the length field of the TLV it is published within. 1686 Some transport choices may decrease this limit; if using e.g. UDP 1687 datagrams for unicast transport the upper bound of node data size is 1688 whatever the nodes and the underlying network can pass to each other 1689 as DNCP does not define its own fragmentation scheme. A profile 1690 which chooses UDP has to be limited to small node data (e.g. somewhat 1691 smaller than IPv6 default MTU if using IPv6), or specify a minimum 1692 which all nodes have to support. Even then, if using non-link-local 1693 communications, there is some concern about what middleboxes do to 1694 fragmented packets. Therefore, the use of stream transport such as 1695 TCP is probably a good idea if either non-link-local communication is 1696 desired, or fragmentation is expected to cause problems. 1698 TCP also provides some other facilities, such as a relatively long 1699 built-in keep-alive which in conjunction with connection closes 1700 occurring from eventual failed retransmissions may be sufficient to 1701 avoid the use of in-protocol keep-alive defined in Section 6.1. 1702 Additionally it is reliable, so there is no need for Trickle on such 1703 unicast connections. 1705 The major downside of using TCP instead of UDP with DNCP-based 1706 profiles lies in the loss of control over the time at which TLVs are 1707 received; while unreliable UDP datagrams also have some delay, TLVs 1708 within reliable stream transport may be delayed significantly due to 1709 retransmissions. This is not a problem if no relative time dependent 1710 information is stored within the TLVs in the DNCP-based protocol; for 1711 such a protocol, TCP is a reasonable choice for unicast transport if 1712 it is available. 1714 B.2. (Optional) Multicast Transport 1716 Multicast is needed for dynamic peer discovery and to trigger unicast 1717 exchanges; for that, unreliable datagram transport (=typically UDP) 1718 is the only transport option defined within this specification, 1719 although DNCP-based protocols may themselves define some other 1720 transport or peer discovery mechanism (e.g. based on mDNS or DNS). 1722 If multicast is used, a well-known address should be specified, and 1723 for e.g. IPv6 respectively the desired address scopes. In most 1724 cases link-local and possibly site-local are useful scopes. 1726 B.3. (Optional) Transport Security 1728 In terms of provided security, DTLS and TLS are equivalent; they also 1729 consume similar amount of state on the devices. While TLS is on top 1730 of a stream protocol, using DTLS also requires relatively long 1731 session caching within the DTLS layer to avoid expensive re- 1732 authentication/authorization steps if and when any state within the 1733 DNCP network changes or per-peer keep-alive (if enabled) is sent. 1735 TLS implementations (at the time of the writing of the specification) 1736 seem more mature and available (as open source) than DTLS ones. This 1737 may be due to a long history of use with HTTPS. 1739 Some libraries seem not to support multiplexing between insecure and 1740 secure communication on the same port, so specifying distinct ports 1741 for secured and unsecured communication may be beneficial. 1743 Appendix C. Example Profile 1745 This is the DNCP profile of SHSP, an experimental (and for the 1746 purposes of this document fictional) home automation protocol. The 1747 protocol itself is used to make key-value store published by each of 1748 the nodes available to all other nodes for distributed monitoring and 1749 control of a home infrastructure. It defines only one additional TLV 1750 type: a key=value TLV which contains a single key=value assignment 1751 for publication. 1753 o Unicast transport: IPv6 TCP on port EXAMPLE-P1 since only absolute 1754 timestamps are used within the key=value data and since it focuses 1755 primarily on Linux-based nodes which support both protocols well. 1756 Connections from and to non-link-local addresses are ignored to 1757 avoid exposing this protocol outside the secure links. 1759 o Multicast transport: IPv6 UDP on port EXAMPLE-P2 to link-local 1760 scoped multicast address ff02:EXAMPLE. At least one node per link 1761 in the home is assumed to facilitate node discovery without 1762 depending on any other infrastructure. 1764 o Security: None. It is to be used only on trusted links (WPA2-x 1765 wireless, physically secure wired links). 1767 o Additional TLVs to be ignored: None. No DNCP security is 1768 specified, and no new TLVs are defined outside of node data. 1770 o Node identifier length (DNCP_NODE_IDENTIFIER_LENGTH): 32 bits that 1771 are randomly generated. 1773 o Node identifier collision handling: Pick new random node 1774 identifier. 1776 o Trickle parameters: Imin = 200ms, Imax = 7, k = 1. It means at 1777 least one multicast per link in 25 seconds in stable state (0.2 * 1778 2^7). 1780 o Hash function H(x) + length: SHA-256, only 128 bits used. 1781 Relatively fast, and 128 bits should be plenty to prevent random 1782 conflicts (64 bits would most likely be sufficient, too). 1784 o No in-protocol keep-alives (Section 6.1); TCP keep-alive is to be 1785 used. In practice TCP keep-alive is seldom encountered anyway as 1786 changes in network state cause packets to be sent on the unicast 1787 connections, and those that fail sufficiently many retransmissions 1788 are dropped much before keep-alive actually would fire. 1790 o No support for dense multicast-enabled link optimization 1791 (Section 6.2); SHSP is a simple protocol for few nodes (network- 1792 wide, not even to mention on a single link), and therefore would 1793 not provide any benefit. 1795 Appendix D. Some Questions and Answers [RFC Editor: please remove] 1797 Q: 32-bit endpoint id? 1799 A: Here, it would save 32 bits per peer if it was 16 bits (and less 1800 is not realistic). However, TLVs defined elsewhere would not seem to 1801 even gain that much on average. 32 bits is also used for ifindex in 1802 various operating systems, making for simpler implementation. 1804 Q: Why have topology information at all? 1806 A: It is an alternative to the more traditional seq#/TTL-based 1807 flooding schemes. In steady state, there is no need to, e.g., re- 1808 publish every now and then. 1810 Appendix E. Changelog [RFC Editor: please remove] 1812 draft-ietf-homenet-dncp-10: 1814 o Added profile guidance section, as well as example profile. 1816 draft-ietf-homenet-dncp-09: 1818 o Reserved 1024+ TLV types for future versions (=versioning 1819 mechanism); private use section moved from 192-255 to 512-767. 1821 o Added applicability statement and clarified some text based on 1822 reviews. 1824 draft-ietf-homenet-dncp-08: 1826 o Removed fragmentation as it is somewhat underspecified and 1827 unimplemented. It may be specified in some future extension draft 1828 or new version of DNCP. 1830 o Added generic sub-TLV extensibility mechanism. 1832 draft-ietf-homenet-dncp-06: 1834 o Removed custom TLV. 1836 o Made keep-alive multipliers local implementation choice, profiles 1837 just provide guidance on sane default value. 1839 o Removed the DNCP_GRACE_INTERVAL as it is really implementation 1840 choice. 1842 o Simplified the suggested structures in data model. 1844 o Reorganized the document and provided an overview section. 1846 draft-ietf-homenet-dncp-04: 1848 o Added mandatory rate limiting for network state requests, and 1849 optional slightly faster convergence mechanism by including 1850 current local network state in the remote network state requests. 1852 draft-ietf-homenet-dncp-03: 1854 o Renamed connection -> endpoint. 1856 o !!! Backwards incompatible change: Renumbered TLVs, and got rid of 1857 node data TLV; instead, node data TLV's contents are optionally 1858 within node state TLV. 1860 draft-ietf-homenet-dncp-02: 1862 o Changed DNCP "messages" into series of TLV streams, allowing 1863 optimized round-trip saving synchronization. 1865 o Added fragmentation support for bigger node data and for chunking 1866 in absence of reliable L2 and L3 fragmentation. 1868 draft-ietf-homenet-dncp-01: 1870 o Fixed keep-alive semantics to consider unicast requests also 1871 updates of most recently consistent, and added proactive unicast 1872 request to ensure even inconsistent keep-alive messages eventually 1873 triggering consistency timestamp update. 1875 o Facilitated (simple) read-only clients by making Node Connection 1876 TLV optional if just using DNCP for read-only purposes. 1878 o Added text describing how to deal with "dense" networks, but left 1879 actual numbers and mechanics up to DNCP profiles and (local) 1880 configurations. 1882 draft-ietf-homenet-dncp-00: Split from pre-version of draft-ietf- 1883 homenet-hncp-03 generic parts. Changes that affect implementations: 1885 o TLVs were renumbered. 1887 o TLV length does not include header (=-4). This facilitates, e.g., 1888 use of DHCPv6 option parsing libraries (same encoding), and 1889 reduces complexity (no need to handle error values of length less 1890 than 4). 1892 o Trickle is reset only when locally calculated network state hash 1893 is changes, not as remote different network state hash is seen. 1894 This prevents, e.g., attacks by multicast with one multicast 1895 packet to force Trickle reset on every interface of every node on 1896 a link. 1898 o Instead of 'ping', use 'keep-alive' (optional) for dead peer 1899 detection. Different message used! 1901 Appendix F. Draft Source [RFC Editor: please remove] 1903 As usual, this draft is available at https://github.com/fingon/ietf- 1904 drafts/ in source format (with nice Makefile too). Feel free to send 1905 comments and/or pull requests if and when you have changes to it! 1907 Appendix G. Acknowledgements 1909 Thanks to Ole Troan, Pierre Pfister, Mark Baugher, Mark Townsley, 1910 Juliusz Chroboczek, Jiazi Yi, Mikael Abrahamsson, Brian Carpenter, 1911 Thomas Clausen, DENG Hui and Margaret Cullen for their contributions 1912 to the draft. 1914 Thanks to Kaiwen Jin and Xavier Bonnetain for their related research 1915 work. 1917 Authors' Addresses 1919 Markus Stenberg 1920 Independent 1921 Helsinki 00930 1922 Finland 1924 Email: markus.stenberg@iki.fi 1926 Steven Barth 1927 Independent 1928 Halle 06114 1929 Germany 1931 Email: cyrus@openwrt.org