idnits 2.17.1 draft-ietf-homenet-dncp-06.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 160 has weird spacing: '...ntifier an o...' == Line 210 has weird spacing: '...e trust the ...' == Line 214 has weird spacing: '...y graph the...' -- The document date (June 20, 2015) is 3226 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) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Homenet Working Group M. Stenberg 3 Internet-Draft 4 Intended status: Standards Track S. Barth 5 Expires: December 22, 2015 6 June 20, 2015 8 Distributed Node Consensus Protocol 9 draft-ietf-homenet-dncp-06 11 Abstract 13 This document describes the Distributed Node Consensus Protocol 14 (DNCP), a generic state synchronization protocol which uses Trickle 15 and Merkle trees. DNCP leaves some details unspecified or provides 16 alternative options. Therefore, only profiles which specify those 17 missing parts define actual implementable DNCP based protocols. 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on December 22, 2015. 36 Copyright Notice 38 Copyright (c) 2015 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 54 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 55 2.1. Requirements Language . . . . . . . . . . . . . . . . . . 5 56 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 5 57 4. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 6 58 4.1. Merkle Tree . . . . . . . . . . . . . . . . . . . . . . . 6 59 4.2. Data Transport . . . . . . . . . . . . . . . . . . . . . 7 60 4.3. Trickle-Driven Status Updates . . . . . . . . . . . . . . 8 61 4.4. Processing of Received TLVs . . . . . . . . . . . . . . . 9 62 4.5. Adding and Removing Peers . . . . . . . . . . . . . . . . 11 63 4.6. Data Liveliness Validation . . . . . . . . . . . . . . . 11 64 5. Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 12 65 6. Optional Extensions . . . . . . . . . . . . . . . . . . . . . 13 66 6.1. Keep-Alives . . . . . . . . . . . . . . . . . . . . . . . 13 67 6.1.1. Data Model Additions . . . . . . . . . . . . . . . . 14 68 6.1.2. Per-Endpoint Periodic Keep-Alives . . . . . . . . . . 14 69 6.1.3. Per-Peer Periodic Keep-Alives . . . . . . . . . . . . 14 70 6.1.4. Received TLV Processing Additions . . . . . . . . . . 15 71 6.1.5. Neighbor Removal . . . . . . . . . . . . . . . . . . 15 72 6.2. Support For Dense Broadcast Links . . . . . . . . . . . . 15 73 6.3. Node Data Fragmentation . . . . . . . . . . . . . . . . . 16 74 7. Type-Length-Value Objects . . . . . . . . . . . . . . . . . . 17 75 7.1. Request TLVs . . . . . . . . . . . . . . . . . . . . . . 17 76 7.1.1. Request Network State TLV . . . . . . . . . . . . . . 17 77 7.1.2. Request Node State TLV . . . . . . . . . . . . . . . 18 78 7.2. Data TLVs . . . . . . . . . . . . . . . . . . . . . . . . 18 79 7.2.1. Node Endpoint TLV . . . . . . . . . . . . . . . . . . 18 80 7.2.2. Network State TLV . . . . . . . . . . . . . . . . . . 18 81 7.2.3. Node State TLV . . . . . . . . . . . . . . . . . . . 19 82 7.3. Data TLVs within Node State TLV . . . . . . . . . . . . . 20 83 7.3.1. Fragment Count TLV . . . . . . . . . . . . . . . . . 20 84 7.3.2. Neighbor TLV . . . . . . . . . . . . . . . . . . . . 20 85 7.3.3. Keep-Alive Interval TLV . . . . . . . . . . . . . . . 21 86 8. Security and Trust Management . . . . . . . . . . . . . . . . 22 87 8.1. Pre-Shared Key Based Trust Method . . . . . . . . . . . . 22 88 8.2. PKI Based Trust Method . . . . . . . . . . . . . . . . . 22 89 8.3. Certificate Based Trust Consensus Method . . . . . . . . 22 90 8.3.1. Trust Verdicts . . . . . . . . . . . . . . . . . . . 23 91 8.3.2. Trust Cache . . . . . . . . . . . . . . . . . . . . . 24 92 8.3.3. Announcement of Verdicts . . . . . . . . . . . . . . 24 93 8.3.4. Bootstrap Ceremonies . . . . . . . . . . . . . . . . 25 94 9. DNCP Profile-Specific Definitions . . . . . . . . . . . . . . 26 95 10. Security Considerations . . . . . . . . . . . . . . . . . . . 28 96 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28 97 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 29 98 12.1. Normative references . . . . . . . . . . . . . . . . . . 29 99 12.2. Informative references . . . . . . . . . . . . . . . . . 29 100 Appendix A. Some Questions and Answers [RFC Editor: please 101 remove] . . . . . . . . . . . . . . . . . . . . . . 29 102 Appendix B. Changelog [RFC Editor: please remove] . . . . . . . 30 103 Appendix C. Draft Source [RFC Editor: please remove] . . . . . . 31 104 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 31 105 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 31 107 1. Introduction 109 DNCP is designed to provide a way for each participating node to 110 publish a set of TLV (Type-Length-Value) tuples, and to provide a 111 shared and common view about the data published by every currently or 112 recently bidirectionally reachable DNCP node in a network. 114 For state synchronization a Merkle tree is used. It is formed by 115 first calculating a hash for the dataset, called node data, published 116 by each node, and then calculating another hash over those node data 117 hashes. The single resulting hash, called network state hash, is 118 transmitted using the Trickle algorithm [RFC6206] to ensure that all 119 nodes share the same view of the current state of the published data 120 within the network. The use of Trickle with only short network state 121 hashes sent infrequently (in steady state) makes DNCP very thrifty 122 when updates happen rarely. 124 For maintaining liveliness of the topology and the data within it, a 125 combination of Trickled network state, keep-alives, and "other" means 126 of ensuring reachability are used. The core idea is that if every 127 node ensures its neighbors are present, transitively, the whole 128 network state also stays up-to-date. 130 DNCP is most suitable for data that changes only infrequently to gain 131 the maximum benefit from using Trickle. As the network of nodes, or 132 the rate of data changes grows over a given time interval, Trickle is 133 eventually used less and less and the benefit of using DNCP 134 diminishes. In these cases Trickle just provides extra complexity 135 within the specification and little added value. If constant rapid 136 state changes are needed, the preferable choice is to use an 137 additional point-to-point channel whose address or locator is 138 published using DNCP. 140 2. Terminology 142 DNCP profile a definition of the set of rules and values listed 143 in Section 9 specifying the behavior of a DNCP 144 based protocol, such as the transport method in 145 use. In this document, any DNCP profile specific 146 parameter with a profile-specific fixed value is 147 prefixed with DNCP_. 149 DNCP node a single node which runs a protocol based on a DNCP 150 profile. 152 Link a link-layer media over which directly connected 153 nodes can communicate. 154 DNCP network a set of DNCP nodes running the same DNCP profile. 155 The set consists of nodes that have discovered each 156 other using the transport method defined in the 157 DNCP profile, via multicast on local links, and/or 158 by using unicast communication. 160 Node identifier an opaque fixed-length identifier consisting of 161 DNCP_NODE_IDENTIFIER_LENGTH bytes which uniquely 162 identifies a DNCP node within a DNCP network. 164 Interface a node's attachment to a particular link. 166 Endpoint a locally configured communication endpoint of a 167 DNCP node, such as a network socket. It is either 168 bound to an Interface for multicast and unicast 169 communication, or configured for explicit unicast 170 communication with a predefined set of remote 171 addresses. Endpoints are usually in one of the 172 transport modes specified in Section 4.2. 174 Endpoint a 32-bit opaque value, which identifies a 175 identifier particular endpoint of a particular DNCP node. The 176 value 0 is reserved for DNCP and DNCP profile 177 purposes and not used to identify an actual 178 endpoint. This definition is in sync with the 179 interface index definition in [RFC3493], as the 180 non-zero small positive integers should comfortably 181 fit within 32 bits. 183 Peer another DNCP node with which a DNCP node 184 communicates using a particular local and remote 185 endpoint pair. 187 Node data a set of TLVs published and owned by a node in the 188 DNCP network. Other nodes pass it along as-is, even 189 if they cannot fully interpret it. 191 Node state a set of metadata attributes for node data. It 192 includes a sequence number for versioning, a hash 193 value for comparing equality of stored node data, 194 and a timestamp indicating the time passed since 195 its last publication. The hash function and the 196 length of the hash value are defined in the DNCP 197 profile. 199 Network state a hash value which represents the current state of 200 hash the network. The hash function and the length of 201 the hash value are defined in the DNCP profile. 202 Whenever a node is added, removed or updates its 203 published node data this hash value changes as 204 well. For calculation, please see Section 4.1. 206 Trust verdict a statement about the trustworthiness of a 207 certificate announced by a node participating in 208 the certificate based trust consensus mechanism. 210 Effective trust the trust verdict with the highest priority within 211 verdict the set of trust verdicts announced for the 212 certificate in the DNCP network. 214 Topology graph the undirected graph of DNCP nodes produced by 215 retaining only bidirectional peer relationships 216 between nodes. 218 2.1. Requirements Language 220 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 221 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 222 "OPTIONAL" in this document are to be interpreted as described in RFC 223 2119 [RFC2119]. 225 3. Overview 227 DNCP operates primarily using unicast exchanges between nodes, and 228 may use multicast for Trickle-based shared state dissemination and 229 topology discovery. If used in pure unicast mode with unreliable 230 transport, Trickle is also used between peers. 232 DNCP discovers the topology of its nodes and maintains the liveliness 233 of published node data by ensuring that the publishing node was - at 234 least recently - bidirectionally reachable. This is determined, 235 e.g., by a recent and consistent multicast or unicast TLV exchange 236 with its peers. New potential peers can be discovered autonomously 237 on multicast-enabled links, their addresses may be manually 238 configured or they may be found by some other means defined in a 239 later specification. 241 A Merkle tree is maintained by each node to represent the state of 242 all currently reachable nodes and the Trickle algorithm is used to 243 trigger synchronization. Consistency among neighboring nodes is 244 thereby determined by comparing the current root of their respective 245 trees, i.e., their individually calculated network state hashes. 247 Before joining a DNCP network, a node starts with a Merkle tree (and 248 therefore a calculated network state hash) only consisting of the 249 node itself. It then announces said hash by means of the Trickle 250 algorithm on all its configured endpoints. 252 When an update is detected by a node (e.g., by receiving an 253 inconsistent network state hash from a peer) the originator of the 254 event is requested to provide a list of the state of all nodes, i.e., 255 all the information it uses to calculate its own Merkle tree. The 256 node uses the list to determine whether its own information is 257 outdated and - if necessary - requests the actual node data that has 258 changed. 260 Whenever a node's local copy of any node data and its Merkle tree are 261 updated (e.g., due to its own or another node's node state changing 262 or due to a peer being added or removed) its Trickle instances are 263 reset which eventually causes any update to be propagated to all of 264 its peers. 266 4. Operation 268 4.1. Merkle Tree 270 Each DNCP node maintains a Merkle tree of height 1 to manage state 271 updates of individual DNCP nodes, the leaves of the tree, and the 272 network as a whole, the root of the tree. 274 Each leaf represents one recently bidirectionally reachable node (see 275 Section 4.6), and is represented by a tuple consisting of the node's 276 update sequence number in network byte order concatenated with the 277 hash-value of the node's ordered node data published in the Node 278 State TLV (Section 7.2.3). These leaves are ordered in ascending 279 order of the respective node identifiers. The root of the tree - the 280 network state hash - is represented by the hash-value calculated over 281 all such leaf tuples concatenated in order. It is used to determine 282 whether the view of the network of two or more nodes is consistent 283 and shared. 285 The leaves and the root network state hash are updated on-demand and 286 whenever any locally stored per-node state changes. This includes 287 local unidirectional reachability encoded in the published Neighbor 288 TLV (Section 7.3.2)s and - when combined with remote data - results 289 in awareness of bidirectional reachability changes. 291 4.2. Data Transport 293 DNCP has relatively few requirements for the underlying transport; it 294 requires some way of transmitting either unicast datagram or stream 295 data to a peer and, if used in multicast mode, a way of sending 296 multicast datagrams. As multicast is used only to identify potential 297 new DNCP nodes and to send status messages which merely notify that a 298 unicast exchange should be triggered, the multicast transport does 299 not have to be secured. If unicast security is desired and one of 300 the built-in security methods is to be used, support for some TLS- 301 derived transport scheme - such as TLS [RFC5246] on top of TCP or 302 DTLS [RFC6347] on top of UDP - is also required. A specific 303 definition of the transport(s) in use and their parameters MUST be 304 provided by the DNCP profile. 306 TLVs are sent across the transport as is, and they SHOULD be sent 307 together where, e.g., MTU considerations do not recommend sending 308 them in multiple batches. TLVs in general are handled individually 309 and statelessly, with one exception. To form bidirectional peer 310 relationships DNCP requires identification of the endpoints used for 311 communication. A DNCP node desiring bidirectional peer relationship 312 therefore MUST send an Endpoint TLV (Section 7.2.1). When it is sent 313 varies, depending on the underlying transport: 315 o If using a stream transport, the TLV SHOULD be sent only once 316 within the stream. 318 o If using datagram transport, it MUST be included in every 319 datagram. 321 Bidirectional peer relationship is not necessary for read-only access 322 to the DNCP state, but it is required to be able to publish data. 324 Given the assorted transport options as well as potential endpoint 325 configuration, a DNCP endpoint may be used in various transport 326 modes: 328 Unicast: 330 * If only reliable unicast transport is employed, Trickle is not 331 used at all. Where Trickle reset occurs, a single Network 332 State TLV (Section 7.2.2) is sent instead to every unicast 333 peer. Additionally, recently changed Node State TLV 334 (Section 7.2.3)s MAY be included. 336 * If only unreliable unicast transport is employed, Trickle state 337 is kept per each peer and it is used to send Network State TLVs 338 every now and then, as specified in Section 4.3. 340 Multicast+Unicast: If multicast datagram transport is available on 341 an endpoint, Trickle state is only maintained for the endpoint as 342 a whole. It is used to send Network State TLVs every now and 343 then, as specified in Section 4.3. Additionally, per-endpoint 344 keep-alives MAY be defined in the DNCP profile, as specified in 345 Section 6.1.2. 347 MulticastListen+Unicast: Just like Unicast, except multicast 348 transmissions are listened to in order to detect changes of the 349 highest node identifier. This mode is used only if the DNCP 350 profile supports dense broadcast link optimization (Section 6.2). 352 4.3. Trickle-Driven Status Updates 354 The Trickle algorithm has 3 parameters: Imin, Imax and k. Imin and 355 Imax represent the minimum and maximum values for I, which is the 356 time interval during which at least k Trickle updates must be seen on 357 an endpoint to prevent local state transmission. The actual 358 suggested Trickle algorithm parameters are DNCP profile specific, as 359 described in Section 9. 361 The Trickle state for all Trickle instances is considered 362 inconsistent and reset if and only if the locally calculated network 363 state hash changes. This occurs either due to a change in the local 364 node's own node data, or due to receipt of more recent data from 365 another node. 367 Every time a particular Trickle instance indicates that an update 368 should be sent, the node MUST send a Network State TLV 369 (Section 7.2.2) if and only if: 371 o the endpoint is in Multicast+Unicast transport mode, in which case 372 the TLV MUST be sent over multicast. 374 o the endpoint is NOT in Multicast+Unicast transport mode, and the 375 unicast transport is unreliable, in which case the TLV MUST be 376 sent over unicast. 378 A (sub)set of all Node State TLVs (Section 7.2.3) MAY also be 379 included, unless it is defined as undesirable for some reason by the 380 DNCP profile, or to avoid exposure of the node state TLVs by 381 transmitting them within insecure multicast when using also secure 382 unicast. 384 4.4. Processing of Received TLVs 386 This section describes how received TLVs are processed. The DNCP 387 profile may specify when to ignore particular TLVs, e.g., to modify 388 security properties - see Section 9 for what may be safely defined to 389 be ignored in a profile. Any 'reply' mentioned in the steps below 390 denotes sending of the specified TLV(s) over unicast to the 391 originator of the TLV being processed. If the TLV being replied to 392 was received via multicast and it was sent to a link with shared 393 bandwidth, the reply SHOULD be delayed by a random timespan in [0, 394 Imin/2], to avoid potential simultaneous replies that may cause 395 problems on some links. Sending of replies MAY also be rate-limited 396 or omitted for a short period of time by an implementation. However, 397 an implementation MUST eventually reply to similar repeated requests, 398 as otherwise state synchronization would break. 400 A DNCP node MUST process TLVs received from any valid address, as 401 specified by a given DNCP profile and the configuration of a 402 particular endpoint, whether this address is known to be the address 403 of a neighbor or not. This provision satisfies the needs of 404 monitoring or other host software that needs to discover the DNCP 405 topology without adding to the state in the network. 407 Upon receipt of: 409 o Request Network State TLV (Section 7.1.1): The receiver MUST reply 410 with a Network State TLV (Section 7.2.2) and a Node State TLV 411 (Section 7.2.3) for each node data used to calculate the network 412 state hash. The Node State TLVs MUST NOT contain the optional 413 node data part unless explicitly specified in the DNCP profile. 415 o Request Node State TLV (Section 7.1.2): If the receiver has node 416 data for the corresponding node, it MUST reply with a Node State 417 TLV (Section 7.2.3) for the corresponding node. The optional node 418 data part MUST be included in the TLV. 420 o Network State TLV (Section 7.2.2): If the network state hash 421 differs from the locally calculated network state hash, and the 422 receiver is unaware of any particular node state differences with 423 the sender, the receiver MUST reply with a Request Network State 424 TLV (Section 7.1.1). These replies MUST be rate limited to only 425 at most one reply per link per unique network state hash within 426 Imin. The simplest way to ensure this rate limit is a timestamp 427 indicating requests, and sending at most one Request Network State 428 TLV (Section 7.1.1) per Imin. To facilitate faster state 429 synchronization, if a Request Network State TLV is sent in a 430 reply, a local, current Network State TLV MAY also be sent. 432 o Node State TLV (Section 7.2.3): 434 * If the node identifier matches the local node identifier and 435 the TLV has a greater update sequence number than its current 436 local value, or the same update sequence number and a different 437 hash, the node SHOULD re-publish its own node data with an 438 update sequence number significantly (e.g., 1000) greater than 439 the received one, to reclaim the node identifier. This may 440 occur normally once due to the local node restarting and not 441 storing the most recently used update sequence number. If this 442 occurs more than once or for nodes not re-publishing their own 443 node data, the DNCP profile MUST provide guidance on how to 444 handle these situations as it indicates the existence of 445 another active node with the same node identifier. 447 * If the node identifier does not match the local node 448 identifier, and one or more of the following conditions are 449 true: 451 + The local information is outdated for the corresponding node 452 (local update sequence number is less than that within the 453 TLV). 455 + The local information is potentially incorrect (local update 456 sequence number matches but the node data hash differs). 458 + There is no data for that node altogether. 460 Then: 462 + If the TLV does not contain node data, and the hash of the 463 node data differs, the receiver MUST reply with a Request 464 Node State TLV (Section 7.1.2) for the corresponding node. 466 + Otherwise the receiver MUST update its locally stored state 467 for that node (node data if present, update sequence number, 468 relative time) to match the received TLV. 470 For comparison purposes of the update sequence number, a looping 471 comparison function MUST be used to avoid problems in case of 472 overflow. The comparison function a < b <=> (a - b) % 2^32 & 2^31 473 != 0 is RECOMMENDED unless the DNCP profile defines another. 475 o Any other TLV: TLVs not recognized by the receiver MUST be 476 silently ignored. 478 If secure unicast transport is configured for an endpoint, any Node 479 State TLVs received over insecure multicast MUST be silently ignored. 481 4.5. Adding and Removing Peers 483 When receiving a Node Endpoint TLV (Section 7.2.1) on an endpoint 484 from an unknown peer: 486 o If received over unicast, the remote node MUST be added as a peer 487 on the endpoint and a Neighbor TLV (Section 7.3.2) MUST be created 488 for it. 490 o If received over multicast, the node MAY be sent a (possibly rate- 491 limited) unicast Request Network State TLV (Section 7.1.1). 493 If keep-alives specified in Section 6.1 are NOT sent by the peer 494 (either the DNCP profile does not specify the use of keep-alives or 495 the particular peer chooses not to send keep-alives), some other 496 existing local transport-specific means (such as Ethernet carrier- 497 detection or TCP keep-alive) MUST be employed to ensure its presence. 498 When the peer is no longer present, the Neighbor TLV and the local 499 DNCP peer state MUST be removed. 501 If the local endpoint is in the Multicast-Listen+Unicast transport 502 mode, a Neighbor TLV (Section 7.3.2) MUST NOT be published for the 503 peers not having the highest node identifier. 505 4.6. Data Liveliness Validation 507 When a Neighbor TLV or a whole node is added or removed, the topology 508 graph MUST be traversed either immediately or with a small delay 509 shorter than the DNCP profile-defined Trickle Imin. 511 The topology graph traversal starts with the local node. The edges 512 to be traversed are identified by looking for Neighbor TLVs on both 513 nodes, that have the other node's node identifier in the Neighbor 514 Node Identifier, and local and neighbor endpoint identifiers swapped. 515 Each node reached is marked currently reachable. 517 DNCP nodes that have not been reachable in the most recent topology 518 graph traversal MUST NOT be used for calculation of the network state 519 hash, be provided to any applications that need to use the whole TLV 520 graph, or be provided to remote nodes. They MAY be removed 521 immediately after the topology graph traversal, however it is 522 RECOMMENDED to keep them at least briefly to improve the speed of 523 DNCP network state convergence and to reduce the number of redundant 524 state transmissions between nodes. 526 5. Data Model 528 This section describes the local data structures a minimal 529 implementation might use. This section is provided only as a 530 convenience for the implementor. Some of the optional extensions 531 (Section 6) describe additional data requirements, and some optional 532 parts of the core protocol may also require more. 534 A DNCP node has: 536 o A data structure containing data about the most recently sent 537 Request Network State TLVs (Section 7.1.1). The simplest option 538 is keeping a timestamp of the most recent request (required to 539 fulfill reply rate limiting specified in Section 4.4). 541 A DNCP node has for every DNCP node in the DNCP network: 543 o Node identifier: the unique identifier of the node. The length, 544 how it is produced, and how collisions are handled, is up to the 545 particular DNCP profile. 547 o Node data: the set of TLV tuples published by that particular 548 node. As they are transmitted ordered (see Node State TLV 549 (Section 7.2.3) for details), maintaining the order within the 550 data structure here may be reasonable. 552 o Latest update sequence number: the 32-bit sequence number that is 553 incremented any time the TLV set is published. The comparison 554 function used to compare them is described in Section 4.4. 556 o Origination time: the (estimated) time when the current TLV set 557 with the current update sequence number was published. It is used 558 to populate the Milliseconds Since Origination field in a Node 559 State TLV (Section 7.2.3). Ideally it also has millisecond 560 accuracy. 562 Additionally, a DNCP node has a set of endpoints for which DNCP is 563 configured to be used. For each such endpoint, a node has: 565 o Endpoint identifier: the 32-bit opaque value uniquely identifying 566 it within the local node. 568 o Trickle instance: the endpoint's Trickle instance with parameters 569 I, T, and c (only on an endpoint in Multicast+Unicast transport 570 mode). 572 and one (or more) of the following: 574 o Interface: the assigned local network interface. 576 o Unicast address: the DNCP node it should connect with. 578 o Range of addresses: the DNCP nodes that are allowed to connect. 580 For each remote (peer, endpoint) pair detected on a local endpoint, a 581 DNCP node has: 583 o Node identifier: the unique identifier of the peer. 585 o Endpoint identifier: the unique endpoint identifier used by the 586 peer. 588 o Peer address: the most recently used address of the peer 589 (authenticated and authorized, if security is enabled). 591 o Trickle instance: the particular peer's Trickle instance with 592 parameters I, T, and c (only on a unicast-only endpoint with 593 unreliable unicast transport) . 595 6. Optional Extensions 597 This section specifies extensions to the core protocol that a DNCP 598 profile may use. 600 6.1. Keep-Alives 602 Trickle-driven status updates (Section 4.3) provide a mechanism for 603 handling of new peer detection on an endpoint, as well as state 604 change notifications. Another mechanism may be needed to get rid of 605 old, no longer valid peers if the transport or lower layers do not 606 provide one. 608 If keep-alives are not specified in the DNCP profile, the rest of 609 this subsection MUST be ignored. 611 A DNCP profile MAY specify either per-endpoint or per-peer keep-alive 612 support. 614 For every endpoint that a keep-alive is specified for in the DNCP 615 profile, the endpoint-specific keep-alive interval MUST be 616 maintained. By default, it is DNCP_KEEPALIVE_INTERVAL. If there is 617 a local value that is preferred for that for any reason 618 (configuration, energy conservation, media type, ..), it can be 619 substituted instead. If a non-default keep-alive interval is used on 620 any endpoint, a DNCP node MUST publish appropriate Keep-Alive 621 Interval TLV(s) (Section 7.3.3) within its node data. 623 6.1.1. Data Model Additions 625 The following additions to the Data Model (Section 5) are needed to 626 support keep-alives: 628 For each configured endpoint that has per-endpoint keep-alives 629 enabled: 631 o Last sent: If a timestamp which indicates the last time a Network 632 State TLV (Section 7.2.2) was sent over that interface. 634 For each remote (peer, endpoint) pair detected on a local endpoint, a 635 DNCP node has: 637 o Last contact timestamp: a timestamp which indicates the last time 638 a consistent Network State TLV (Section 7.2.2) was received from 639 the peer over multicast, or anything was received over unicast. 640 When adding a new peer, it is initialized to the current time. 642 o Last sent: If per-peer keep-alives are enabled, a timestamp which 643 indicates the last time a Network State TLV (Section 7.2.2) was 644 sent to to that point-to-point peer. When adding a new peer, it 645 is initialized to the current time. 647 6.1.2. Per-Endpoint Periodic Keep-Alives 649 If per-endpoint keep-alives are enabled on an endpoint in 650 Multicast+Unicast transport mode, and if no traffic containing a 651 Network State TLV (Section 7.2.2) has been sent to a particular 652 endpoint within the endpoint-specific keep-alive interval, a Network 653 State TLV (Section 7.2.2) MUST be sent on that endpoint, and a new 654 Trickle transmission time 't' in [I/2, I] MUST be randomly chosen. 655 The actual sending time SHOULD be further delayed by a random 656 timespan in [0, Imin/2]. 658 6.1.3. Per-Peer Periodic Keep-Alives 660 If per-peer keep-alives are enabled on a unicast-only endpoint, and 661 if no traffic containing a Network State TLV (Section 7.2.2) has been 662 sent to a particular peer within the endpoint-specific keep-alive 663 interval, a Network State TLV (Section 7.2.2) MUST be sent to the 664 peer and a new Trickle transmission time 't' in [I/2, I] MUST be 665 randomly chosen. 667 6.1.4. Received TLV Processing Additions 669 If a TLV is received over unicast from the peer, the Last contact 670 timestamp for the peer MUST be updated. 672 On receipt of a Network State TLV (Section 7.2.2) which is consistent 673 with the locally calculated network state hash, the Last contact 674 timestamp for the peer MUST be updated. 676 6.1.5. Neighbor Removal 678 For every peer on every endpoint, the endpoint-specific keep-alive 679 interval must be calculated by looking for Keep-Alive Interval TLVs 680 (Section 7.3.3) published by the node, and if none exist, using the 681 default value of DNCP_KEEPALIVE_INTERVAL. If the peer's last contact 682 timestamp has not been updated for at least locally chosen 683 potentially endpoint-specific keep-alive multiplier (defaults to 684 DNCP_KEEPALIVE_MULTIPLIER) times the peer's endpoint-specific keep- 685 alive interval, the Neighbor TLV for that peer and the local DNCP 686 peer state MUST be removed. 688 6.2. Support For Dense Broadcast Links 690 This optimization is needed to avoid a state space explosion. Given 691 a large set of DNCP nodes publishing data on an endpoint that 692 actually uses multicast on a link, every node will add a Neighbor TLV 693 (Section 7.3.2) for each peer. While Trickle limits the amount of 694 traffic on the link in stable state to some extent, the total amount 695 of data that is added to and maintained in the DNCP network given N 696 nodes on a multicast-enabled link is O(N^2). Additionally if per- 697 peer keep-alives are employed, there will be O(N^2) keep-alives 698 running on the link if liveliness of peers is not ensured using some 699 other way (e.g., TCP connection lifetime, layer 2 notification, per- 700 endpoint keep-alive). 702 An upper bound for the number of neighbors that are allowed for a 703 particular type of link that an endpoint in Multicast+Unicast 704 transport mode is used on SHOULD be provided by a DNCP profile, but 705 MAY also be chosen at runtime. Main consideration when selecting a 706 bound (if any) for a particular type of link should be whether it 707 supports broadcast traffic, and whether a too large number of 708 neighbors case is likely to happen during the use of that particular 709 DNCP profile on that particular type of link. If neither is likely, 710 there is little point specifying support for this for that particular 711 link type. 713 If a DNCP profile does not support this extension at all, the rest of 714 this subsection MUST be ignored. This is because when this extension 715 is employed, the state within the DNCP network only contains a subset 716 of the full topology of the network. Therefore every node must be 717 aware of the potential of it being used in a particular DNCP profile. 719 If the specified upper bound is exceeded for some endpoint in 720 Multicast+Unicast transport mode and if the node does not have the 721 highest node identifier on the link, it SHOULD treat the endpoint as 722 a unicast endpoint connected to the node that has the highest node 723 identifier detected on the link, therefore transitioning to 724 Multicast-listen+Unicast transport mode. The nodes in Multicast- 725 listen+Unicast transport mode MUST keep listening to multicast 726 traffic to both receive messages from the node(s) still in 727 Multicast+Unicast mode, and as well to react to nodes with a greater 728 node identifier appearing. If the highest node identifier present on 729 the link changes, the remote unicast address of the endpoints in 730 Multicast-Listen+Unicast transport mode MUST be changed. If the node 731 identifier of the local node is the highest one, the node MUST switch 732 back to, or stay in Multicast+Unicast mode, and normally form peer 733 relationships with all peers. 735 6.3. Node Data Fragmentation 737 A DNCP profile may be required to support node data which would not 738 fit the maximum size of a single Node State TLV (Section 7.2.3) 739 (roughly 64KB of payload), or use a datagram-only transport with a 740 limited MTU and no reliable support for fragmentation. To handle 741 such cases, a DNCP profile MAY specify a fixed number of trailing 742 bytes in the node identifier to represent a fragment number 743 indicating a part of a node's node data. The profile MAY also 744 specify an upper bound for the size of a single fragment to 745 accommodate limitations of links in the network. Note that the 746 maximum size of fragment also constrains the maximum size of a single 747 TLV published by a node. 749 The data within Node State TLVs of all fragments MUST be valid, as 750 specified in Section 7.2.3. The locally used node data for a 751 particular node MUST be produced by concatenating node data in each 752 fragment, in ascending fragment number order. The locally used 753 concatenated node data MUST still follow the ordering described in 754 Section 7.2.3. 756 Any transmitted node identifiers used to identify the own or any 757 other node MUST have the fragment number 0. For algorithm purposes, 758 the relative time since the most recent fragment change MUST be used, 759 regardless of fragment number. Therefore, even if just some of the 760 node data fragments change, they all are considered refreshed if one 761 of them is. 763 If using fragmentation, the data liveliness validation defined in 764 Section 4.6 is extended so that if a Fragment Count TLV 765 (Section 7.3.1) is present within the fragment number 0, all 766 fragments up to fragment number specified in the Count field are also 767 considered reachable if the fragment number 0 itself is reachable 768 based on graph traversal. 770 7. Type-Length-Value Objects 772 Each TLV is encoded as a 2 byte type field, followed by a 2 byte 773 length field (of the value excluding header, in bytes, 0 meaning no 774 value) followed by the value itself, if any. Both type and length 775 fields in the header as well as all integer fields inside the value - 776 unless explicitly stated otherwise - are represented in network byte 777 order. Padding bytes with value zero MUST be added up to the next 4 778 byte boundary if the length is not divisible by 4. These padding 779 bytes MUST NOT be included in the number stored in the length field. 781 0 1 2 3 782 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 783 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 784 | Type | Length | 785 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 786 | Value | 787 | (variable # of bytes) | 788 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 790 For example, type=123 (0x7b) TLV with value 'x' (120 = 0x78) is 791 encoded as: 007B 0001 7800 0000. 793 In this section, the following special notation is used: 795 .. = octet string concatenation operation. 797 H(x) = non-cryptographic hash function specified by DNCP profile. 799 7.1. Request TLVs 801 7.1.1. Request Network State TLV 803 0 1 2 3 804 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 805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 806 | Type: REQ-NETWORK-STATE (1) | Length: 0 | 807 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 808 This TLV is used to request response with a Network State TLV 809 (Section 7.2.2) and all Node State TLVs (Section 7.2.3) (without node 810 data). 812 7.1.2. Request Node State TLV 814 0 1 2 3 815 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 816 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 817 | Type: REQ-NODE-STATE (2) | Length: >0 | 818 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 819 | Node Identifier | 820 | (length fixed in DNCP profile) | 821 ... 822 | | 823 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 825 This TLV is used to request a Node State TLV (Section 7.2.3) 826 (including node data) for the node with the matching node identifier. 828 7.2. Data TLVs 830 7.2.1. Node Endpoint TLV 832 0 1 2 3 833 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 834 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 835 | Type: NODE-ENDPOINT (3) | Length: > 4 | 836 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 837 | Node Identifier | 838 | (length fixed in DNCP profile) | 839 ... 840 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 841 | Endpoint Identifier | 842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 844 This TLV identifies both the local node's node identifier, as well as 845 the particular endpoint's endpoint identifier. It is used when 846 bidirectional peering is desired, as described in the Section 4.2. 848 7.2.2. Network State TLV 849 0 1 2 3 850 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 851 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 852 | Type: NETWORK-STATE (4) | Length: > 0 | 853 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 854 | H(update number of node 1 .. H(node data of node 1) .. | 855 | .. update number of node N .. H(node data of node N)) | 856 | (length fixed in DNCP profile) | 857 ... 858 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 860 This TLV contains the current locally calculated network state hash, 861 see Section 4.1 for how it is calculated. 863 7.2.3. Node State TLV 865 0 1 2 3 866 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 867 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 868 | Type: NODE-STATE (5) | Length: > 8 | 869 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 870 | Node Identifier | 871 | (length fixed in DNCP profile) | 872 ... 873 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 874 | Update Sequence Number | 875 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 876 | Milliseconds Since Origination | 877 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 878 | H(node data) | 879 | (length fixed in DNCP profile) | 880 ... 881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 882 |(optionally) Nested TLVs containing node information | 883 ... 884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 886 This TLV represents the local node's knowledge about the published 887 state of a node in the DNCP network identified by the Node Identifier 888 field in the TLV. 890 Every node, including the originating one, MUST update the 891 Milliseconds Since Origination whenever it sends a Node State TLV 892 based on when the node estimates the data was originally published. 893 This is, e.g., to ensure that any relative timestamps contained 894 within the published node data can be correctly offset and 895 interpreted. Ultimately, what is provided is just an approximation, 896 as transmission delays are not accounted for. 898 Absent any changes, if the originating node notices that the 32-bit 899 milliseconds since origination value would be close to overflow 900 (greater than 2^32-2^16), the node MUST re-publish its TLVs even if 901 there is no change. In other words, absent any other changes, the 902 TLV set MUST be re-published roughly every 48 days. 904 The actual node data of the node may be included within the TLV as 905 well. In a DNCP profile which supports fragmentation, described in 906 Section 6.3, the TLV data may be only partial but it MUST contain 907 full individual TLVs. This set of TLVs MUST be strictly ordered 908 based on ascending binary content (including TLV type and length). 909 This enables, e.g., efficient state delta processing and no-copy 910 indexing by TLV type by the recipient. 912 7.3. Data TLVs within Node State TLV 914 These TLVs are published by the DNCP nodes, and therefore only 915 encoded within the Node State TLVs. If encountered outside Node 916 State TLV, they MUST be silently ignored. 918 7.3.1. Fragment Count TLV 920 0 1 2 3 921 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 922 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 923 | Type: FRAGMENT-COUNT (7) | Length: > 0 | 924 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 925 | Count | 926 | (length fixed in DNCP profile) | 927 ... 928 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 930 If the DNCP profile supports node data fragmentation as specified in 931 Section 6.3, this TLV indicates that the node data is encoded as a 932 sequence of Node State TLVs. Following Node State TLVs with Node 933 Identifiers up to Count greater than the current one MUST be 934 considered reachable and part of the same logical set of node data 935 that this TLV is within. The fragment portion of the Node Identifier 936 of the Node State TLV this TLV appears in MUST be zero. 938 7.3.2. Neighbor TLV 939 0 1 2 3 940 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 941 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 942 | Type: NEIGHBOR (8) | Length: > 8 | 943 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 944 | Neighbor Node Identifier | 945 | (length fixed in DNCP profile) | 946 ... 947 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 948 | Neighbor Endpoint Identifier | 949 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 950 | Local Endpoint Identifier | 951 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 953 This TLV indicates that the node in question vouches that the 954 specified neighbor is reachable by it on the specified local 955 endpoint. The presence of this TLV at least guarantees that the node 956 publishing it has received traffic from the neighbor recently. For 957 guaranteed up-to-date bidirectional reachability, the existence of 958 both nodes' matching Neighbor TLVs needs to be checked. 960 7.3.3. Keep-Alive Interval TLV 962 0 1 2 3 963 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 964 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 965 | Type: KEEP-ALIVE-INTERVAL (9) | Length: 8 | 966 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 967 | Endpoint Identifier | 968 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 969 | Interval | 970 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 972 This TLV indicates a non-default interval being used to send keep- 973 alives specified in Section 6.1. 975 Endpoint identifier is used to identify the particular endpoint for 976 which the interval applies. If 0, it applies for ALL endpoints for 977 which no specific TLV exists. 979 Interval specifies the interval in milliseconds at which the node 980 sends keep-alives. A value of zero means no keep-alives are sent at 981 all; in that case, some lower layer mechanism that ensures presence 982 of nodes MUST be available and used. 984 8. Security and Trust Management 986 If specified in the DNCP profile, either DTLS [RFC6347] or TLS 987 [RFC5246] may be used to authenticate and encrypt either some (if 988 specified optional in the profile), or all unicast traffic. The 989 following methods for establishing trust are defined, but it is up to 990 the DNCP profile to specify which ones may, should or must be 991 supported. 993 8.1. Pre-Shared Key Based Trust Method 995 A PSK-based trust model is a simple security management mechanism 996 that allows an administrator to deploy devices to an existing network 997 by configuring them with a pre-defined key, similar to the 998 configuration of an administrator password or WPA-key. Although 999 limited in nature it is useful to provide a user-friendly security 1000 mechanism for smaller networks. 1002 8.2. PKI Based Trust Method 1004 A PKI-based trust-model enables more advanced management capabilities 1005 at the cost of increased complexity and bootstrapping effort. It 1006 however allows trust to be managed in a centralized manner and is 1007 therefore useful for larger networks with a need for an authoritative 1008 trust management. 1010 8.3. Certificate Based Trust Consensus Method 1012 The certificate-based consensus model is designed to be a compromise 1013 between trust management effort and flexibility. It is based on 1014 X.509-certificates and allows each DNCP node to provide a trust 1015 verdict on any other certificate and a consensus is found to 1016 determine whether a node using this certificate or any certificate 1017 signed by it is to be trusted. 1019 A DNCP node not using this security method MUST ignore all announced 1020 trust verdicts and MUST NOT announce any such verdicts by itself, 1021 i.e., any other normative language in this subsection does not apply 1022 to it. 1024 The current effective trust verdict for any certificate is defined as 1025 the one with the highest priority from all trust verdicts announced 1026 for said certificate at the time. 1028 8.3.1. Trust Verdicts 1030 Trust verdicts are statements of DNCP nodes about the trustworthiness 1031 of X.509-certificates. There are 5 possible trust verdicts in order 1032 of ascending priority: 1034 0 (Neutral): no trust verdict exists but the DNCP network should 1035 determine one. 1037 1 (Cached Trust): the last known effective trust verdict was 1038 Configured or Cached Trust. 1040 2 (Cached Distrust): the last known effective trust verdict was 1041 Configured or Cached Distrust. 1043 3 (Configured Trust): trustworthy based upon an external ceremony 1044 or configuration. 1046 4 (Configured Distrust): not trustworthy based upon an external 1047 ceremony or configuration. 1049 Trust verdicts are differentiated in 3 groups: 1051 o Configured verdicts are used to announce explicit trust verdicts a 1052 node has based on any external trust bootstrap or predefined 1053 relation a node has formed with a given certificate. 1055 o Cached verdicts are used to retain the last known trust state in 1056 case all nodes with configured verdicts about a given certificate 1057 have been disconnected or turned off. 1059 o The Neutral verdict is used to announce a new node intending to 1060 join the network so a final verdict for it can be found. 1062 The current effective trust verdict for any certificate is defined as 1063 the one with the highest priority within the set of trust verdicts 1064 announced for the certificate in the DNCP network. A node MUST be 1065 trusted for participating in the DNCP network if and only if the 1066 current effective trust verdict for its own certificate or any one in 1067 its certificate hierarchy is (Cached or Configured) Trust and none of 1068 the certificates in its hierarchy have an effective trust verdict of 1069 (Cached or Configured) Distrust. In case a node has a configured 1070 verdict, which is different from the current effective trust verdict 1071 for a certificate, the current effective trust verdict takes 1072 precedence in deciding trustworthiness. Despite that, the node still 1073 retains and announces its configured verdict. 1075 8.3.2. Trust Cache 1077 Each node SHOULD maintain a trust cache containing the current 1078 effective trust verdicts for all certificates currently announced in 1079 the DNCP network. This cache is used as a backup of the last known 1080 state in case there is no node announcing a configured verdict for a 1081 known certificate. It SHOULD be saved to a non-volatile memory at 1082 reasonable time intervals to survive a reboot or power outage. 1084 Every time a node (re)joins the network or detects the change of an 1085 effective trust verdict for any certificate, it will synchronize its 1086 cache, i.e., store new effective trust verdicts overwriting any 1087 previously cached verdicts. Configured verdicts are stored in the 1088 cache as their respective cached counterparts. Neutral verdicts are 1089 never stored and do not override existing cached verdicts. 1091 8.3.3. Announcement of Verdicts 1093 A node SHOULD always announce any configured trust verdicts it has 1094 established by itself, and it MUST do so if announcing the configured 1095 trust verdict leads to a change in the current effective trust 1096 verdict for the respective certificate. In absence of configured 1097 verdicts, it MUST announce cached trust verdicts it has stored in its 1098 trust cache, if one of the following conditions applies: 1100 o The stored trust verdict is Cached Trust and the current effective 1101 trust verdict for the certificate is Neutral or does not exist. 1103 o The stored trust verdict is Cached Distrust and the current 1104 effective trust verdict for the certificate is Cached Trust. 1106 A node rechecks these conditions whenever it detects changes of 1107 announced trust verdicts anywhere in the network. 1109 Upon encountering a node with a hierarchy of certificates for which 1110 there is no effective trust verdict, a node adds a Neutral Trust- 1111 Verdict-TLV to its node data for all certificates found in the 1112 hierarchy, and publishes it until an effective trust verdict 1113 different from Neutral can be found for any of the certificates, or a 1114 reasonable amount of time (10 minutes is suggested) with no reaction 1115 and no further authentication attempts has passed. Such trust 1116 verdicts SHOULD also be limited in rate and number to prevent denial- 1117 of-service attacks. 1119 Trust verdicts are announced using Trust-Verdict TLVs: 1121 0 1 2 3 1122 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 1123 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1124 | Type: Trust-Verdict (10) | Length: 37-100 | 1125 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1126 | Verdict | (reserved) | 1127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1128 | | 1129 | | 1130 | | 1131 | SHA-256 Fingerprint | 1132 | | 1133 | | 1134 | | 1135 | | 1136 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1137 | Common Name | 1139 Verdict represents the numerical index of the trust verdict. 1141 (reserved) is reserved for future additions and MUST be set to 0 1142 when creating TLVs and ignored when parsing them. 1144 SHA-256 Fingerprint contains the SHA-256 [RFC6234] hash value of 1145 the certificate in DER-format. 1147 Common Name contains the variable-length (1-64 bytes) common name 1148 of the certificate. Final byte MUST have value of 0. 1150 8.3.4. Bootstrap Ceremonies 1152 The following non-exhaustive list of methods describes possible ways 1153 to establish trust relationships between DNCP nodes and node 1154 certificates. Trust establishment is a two-way process in which the 1155 existing network must trust the newly added node and the newly added 1156 node must trust at least one of its neighboring nodes. It is 1157 therefore necessary that both the newly added node and an already 1158 trusted node perform such a ceremony to successfully introduce a node 1159 into the DNCP network. In all cases an administrator MUST be 1160 provided with external means to identify the node belonging to a 1161 certificate based on its fingerprint and a meaningful common name. 1163 8.3.4.1. Trust by Identification 1165 A node implementing certificate-based trust MUST provide an interface 1166 to retrieve the current set of effective trust verdicts, fingerprints 1167 and names of all certificates currently known and set configured 1168 trust verdicts to be announced. Alternatively it MAY provide a 1169 companion DNCP node or application with these capabilities with which 1170 it has a pre-established trust relationship. 1172 8.3.4.2. Preconfigured Trust 1174 A node MAY be preconfigured to trust a certain set of node or CA 1175 certificates. However such trust relationships MUST NOT result in 1176 unwanted or unrelated trust for nodes not intended to be run inside 1177 the same network (e.g., all other devices by the same manufacturer). 1179 8.3.4.3. Trust on Button Press 1181 A node MAY provide a physical or virtual interface to put one or more 1182 of its internal network interfaces temporarily into a mode in which 1183 it trusts the certificate of the first DNCP node it can successfully 1184 establish a connection with. 1186 8.3.4.4. Trust on First Use 1188 A node which is not associated with any other DNCP node MAY trust the 1189 certificate of the first DNCP node it can successfully establish a 1190 connection with. This method MUST NOT be used when the node has 1191 already associated with any other DNCP node. 1193 9. DNCP Profile-Specific Definitions 1195 Each DNCP profile MUST specify the following aspects: 1197 o Unicast and optionally multicast transport protocol(s) to be used. 1198 If multicast-based node and status discovery is desired, a 1199 datagram-based transport supporting multicast has to be available. 1201 o How the chosen transport(s) are secured: Not at all, optionally or 1202 always with the TLS scheme defined here using one or more of the 1203 methods, or with something else. If the links with DNCP nodes can 1204 be sufficiently secured or isolated, it is possible to run DNCP in 1205 a secure manner without using any form of authentication or 1206 encryption. 1208 o Transport protocols' parameters such as port numbers to be used, 1209 or multicast address to be used. Unicast, multicast, and secure 1210 unicast may each require different parameters, if applicable. 1212 o When receiving TLVs, what sort of TLVs are ignored in addition - 1213 as specified in Section 4.4 - e.g., for security reasons. A DNCP 1214 profile may safely define the following DNCP TLVs to be safely 1215 ignored: 1217 * Anything received over multicast, except Node Endpoint TLV 1218 (Section 7.2.1) and Network State TLV (Section 7.2.2). 1220 * Any TLVs received over unreliable unicast or multicast at too 1221 high rate; Trickle will ensure eventual convergence given the 1222 rate slows down at some point. 1224 o How to deal with node identifier collision as described in 1225 Section 4.4. Main options are either for one or both nodes to 1226 assign new node identifiers to themselves, or to notify someone 1227 about a fatal error condition in the DNCP network. 1229 o Imin, Imax and k ranges to be suggested for implementations to be 1230 used in the Trickle algorithm. The Trickle algorithm does not 1231 require these to be the same across all implementations for it to 1232 work, but similar orders of magnitude helps implementations of a 1233 DNCP profile to behave more consistently and to facilitate 1234 estimation of lower and upper bounds for convergence behavior of 1235 the network. 1237 o Hash function H(x) to be used, and how many bits of the output are 1238 actually used. The chosen hash function is used to handle both 1239 hashing of node specific data, and network state hash, which is a 1240 hash of node specific data hashes. SHA-256 defined in [RFC6234] 1241 is the recommended default choice, but a non-cryptographic hash 1242 function could be used as well. 1244 o DNCP_NODE_IDENTIFIER_LENGTH: The fixed length of a node identifier 1245 (in bytes). 1247 o Whether to send keep-alives, and if so, whether per-endpoint 1248 (requires multicast transport), or per-peer. Keep-alive has also 1249 associated parameters: 1251 * DNCP_KEEPALIVE_INTERVAL: How often keep-alives are to be sent 1252 by default (if enabled). 1254 * DNCP_KEEPALIVE_MULTIPLIER: How many times the 1255 DNCP_KEEPALIVE_INTERVAL (or peer-supplied keep-alive interval 1256 value) a node may not be heard from to be considered still 1257 valid. This is just a default used in absence of any other 1258 configuration information, or particular per-endpoint 1259 configuration. 1261 o Whether to support fragmentation, and if so, the number of bytes 1262 reserved for fragment count in the node identifier. 1264 10. Security Considerations 1266 DNCP profiles may use multicast to indicate DNCP state changes and 1267 for keep-alive purposes. However, no actual published data TLVs will 1268 be sent across that channel. Therefore an attacker may only learn 1269 hash values of the state within DNCP and may be able to trigger 1270 unicast synchronization attempts between nodes on a local link this 1271 way. A DNCP node should therefore rate-limit its reactions to 1272 multicast packets. 1274 When using DNCP to bootstrap a network, PKI based solutions may have 1275 issues when validating certificates due to potentially unavailable 1276 accurate time, or due to inability to use the network to either check 1277 Certifcate Revocation Lists or perform on-line validation. 1279 The Certificate-based trust consensus mechanism defined in this 1280 document allows for a consenting revocation, however in case of a 1281 compromised device the trust cache may be poisoned before the actual 1282 revocation happens allowing the distrusted device to rejoin the 1283 network using a different identity. Stopping such an attack might 1284 require physical intervention and flushing of the trust caches. 1286 11. IANA Considerations 1288 IANA should set up a registry for DNCP TLV types, with the following 1289 initial contents: 1291 0: Reserved 1293 1: Request network state 1295 2: Request node state 1297 3: Node endpoint 1299 4: Network state 1301 5: Node state 1303 6: Reserved (was: Custom) 1305 7: Fragment count 1307 8: Neighbor 1309 9: Keep-alive interval 1311 10: Trust-Verdict 1312 32-191: Reserved for per-DNCP profile use 1314 192-255: Reserved for per-implementation experimentation. How 1315 collision is avoided is out of scope of this document. 1317 For the rest of the values (11-31, 256-65535), policy of 'standards 1318 action' should be used. 1320 12. References 1322 12.1. Normative references 1324 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1325 Requirement Levels", BCP 14, RFC 2119, March 1997. 1327 [RFC6206] Levis, P., Clausen, T., Hui, J., Gnawali, O., and J. Ko, 1328 "The Trickle Algorithm", RFC 6206, March 2011. 1330 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 1331 Security Version 1.2", RFC 6347, January 2012. 1333 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1334 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1336 12.2. Informative references 1338 [RFC3493] Gilligan, R., Thomson, S., Bound, J., McCann, J., and W. 1339 Stevens, "Basic Socket Interface Extensions for IPv6", RFC 1340 3493, February 2003. 1342 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1343 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 1345 Appendix A. Some Questions and Answers [RFC Editor: please remove] 1347 Q: 32-bit endpoint id? 1349 A: Here, it would save 32 bits per neighbor if it was 16 bits (and 1350 less is not realistic). However, TLVs defined elsewhere would not 1351 seem to even gain that much on average. 32 bits is also used for 1352 ifindex in various operating systems, making for simpler 1353 implementation. 1355 Q: Why have topology information at all? 1357 A: It is an alternative to the more traditional seq#/TTL-based 1358 flooding schemes. In steady state, there is no need to, e.g., re- 1359 publish every now and then. 1361 Appendix B. Changelog [RFC Editor: please remove] 1363 draft-ietf-homenet-dncp-06: 1365 o Removed custom TLV. 1367 o Made keep-alive multipliers local implementation choice, profiles 1368 just provide guidance on sane default value. 1370 o Removed the DNCP_GRACE_INTERVAL as it is really implementation 1371 choice. 1373 o Simplified the suggested structures in data model. 1375 o Reorganized the document and provided an overview section. 1377 draft-ietf-homenet-dncp-04: 1379 o Added mandatory rate limiting for network state requests, and 1380 optional slightly faster convergence mechanism by including 1381 current local network state in the remote network state requests. 1383 draft-ietf-homenet-dncp-03: 1385 o Renamed connection -> endpoint. 1387 o !!! Backwards incompatible change: Renumbered TLVs, and got rid of 1388 node data TLV; instead, node data TLV's contents are optionally 1389 within node state TLV. 1391 draft-ietf-homenet-dncp-02: 1393 o Changed DNCP "messages" into series of TLV streams, allowing 1394 optimized round-trip saving synchronization. 1396 o Added fragmentation support for bigger node data and for chunking 1397 in absence of reliable L2 and L3 fragmentation. 1399 draft-ietf-homenet-dncp-01: 1401 o Fixed keep-alive semantics to consider unicast requests also 1402 updates of most recently consistent, and added proactive unicast 1403 request to ensure even inconsistent keep-alive messages eventually 1404 triggering consistency timestamp update. 1406 o Facilitated (simple) read-only clients by making Node Connection 1407 TLV optional if just using DNCP for read-only purposes. 1409 o Added text describing how to deal with "dense" networks, but left 1410 actual numbers and mechanics up to DNCP profiles and (local) 1411 configurations. 1413 draft-ietf-homenet-dncp-00: Split from pre-version of draft-ietf- 1414 homenet-hncp-03 generic parts. Changes that affect implementations: 1416 o TLVs were renumbered. 1418 o TLV length does not include header (=-4). This facilitates, e.g., 1419 use of DHCPv6 option parsing libraries (same encoding), and 1420 reduces complexity (no need to handle error values of length less 1421 than 4). 1423 o Trickle is reset only when locally calculated network state hash 1424 is changes, not as remote different network state hash is seen. 1425 This prevents, e.g., attacks by multicast with one multicast 1426 packet to force Trickle reset on every interface of every node on 1427 a link. 1429 o Instead of 'ping', use 'keep-alive' (optional) for dead peer 1430 detection. Different message used! 1432 Appendix C. Draft Source [RFC Editor: please remove] 1434 As usual, this draft is available at https://github.com/fingon/ietf- 1435 drafts/ in source format (with nice Makefile too). Feel free to send 1436 comments and/or pull requests if and when you have changes to it! 1438 Appendix D. Acknowledgements 1440 Thanks to Ole Troan, Pierre Pfister, Mark Baugher, Mark Townsley, 1441 Juliusz Chroboczek, Jiazi Yi, Mikael Abrahamsson, Brian Carpenter and 1442 Thomas Clausen for their contributions to the draft. 1444 Authors' Addresses 1446 Markus Stenberg 1447 Helsinki 00930 1448 Finland 1450 Email: markus.stenberg@iki.fi 1451 Steven Barth 1452 Halle 06114 1453 Germany 1455 Email: cyrus@openwrt.org