idnits 2.17.1 draft-ietf-homenet-dncp-08.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 165 has weird spacing: '...ntifier an o...' == Line 230 has weird spacing: '...e trust the ...' == Line 234 has weird spacing: '...y graph the...' -- The document date (July 21, 2015) is 3202 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) ** Downref: Normative reference to an Informational RFC: RFC 6234 Summary: 3 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 S. Barth 4 Intended status: Standards Track Independent 5 Expires: January 22, 2016 July 21, 2015 7 Distributed Node Consensus Protocol 8 draft-ietf-homenet-dncp-08 10 Abstract 12 This document describes the Distributed Node Consensus Protocol 13 (DNCP), a generic state synchronization protocol that uses Trickle 14 and hash trees. DNCP is an abstract protocol, that must be combined 15 with a specific profile to make a complete implementable protocol. 17 Status of This Memo 19 This Internet-Draft is submitted in full conformance with the 20 provisions of BCP 78 and BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF). Note that other groups may also distribute 24 working documents as Internet-Drafts. The list of current Internet- 25 Drafts is at http://datatracker.ietf.org/drafts/current/. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 This Internet-Draft will expire on January 22, 2016. 34 Copyright Notice 36 Copyright (c) 2015 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents 41 (http://trustee.ietf.org/license-info) in effect on the date of 42 publication of this document. Please review these documents 43 carefully, as they describe your rights and restrictions with respect 44 to this document. Code Components extracted from this document must 45 include Simplified BSD License text as described in Section 4.e of 46 the Trust Legal Provisions and are provided without warranty as 47 described in the Simplified BSD License. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 52 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 53 2.1. Requirements Language . . . . . . . . . . . . . . . . . . 6 54 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 6 55 4. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 7 56 4.1. Hash Tree . . . . . . . . . . . . . . . . . . . . . . . . 7 57 4.2. Data Transport . . . . . . . . . . . . . . . . . . . . . 7 58 4.3. Trickle-Driven Status Updates . . . . . . . . . . . . . . 8 59 4.4. Processing of Received TLVs . . . . . . . . . . . . . . . 9 60 4.5. Adding and Removing Peers . . . . . . . . . . . . . . . . 11 61 4.6. Data Liveliness Validation . . . . . . . . . . . . . . . 12 62 5. Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 13 63 6. Optional Extensions . . . . . . . . . . . . . . . . . . . . . 14 64 6.1. Keep-Alives . . . . . . . . . . . . . . . . . . . . . . . 15 65 6.1.1. Data Model Additions . . . . . . . . . . . . . . . . 15 66 6.1.2. Per-Endpoint Periodic Keep-Alives . . . . . . . . . . 16 67 6.1.3. Per-Peer Periodic Keep-Alives . . . . . . . . . . . . 16 68 6.1.4. Received TLV Processing Additions . . . . . . . . . . 16 69 6.1.5. Peer Removal . . . . . . . . . . . . . . . . . . . . 16 70 6.2. Support For Dense Broadcast Links . . . . . . . . . . . . 16 71 7. Type-Length-Value Objects . . . . . . . . . . . . . . . . . . 17 72 7.1. Request TLVs . . . . . . . . . . . . . . . . . . . . . . 18 73 7.1.1. Request Network State TLV . . . . . . . . . . . . . . 18 74 7.1.2. Request Node State TLV . . . . . . . . . . . . . . . 19 75 7.2. Data TLVs . . . . . . . . . . . . . . . . . . . . . . . . 19 76 7.2.1. Node Endpoint TLV . . . . . . . . . . . . . . . . . . 19 77 7.2.2. Network State TLV . . . . . . . . . . . . . . . . . . 19 78 7.2.3. Node State TLV . . . . . . . . . . . . . . . . . . . 20 79 7.3. Data TLVs within Node State TLV . . . . . . . . . . . . . 21 80 7.3.1. Peer TLV . . . . . . . . . . . . . . . . . . . . . . 21 81 7.3.2. Keep-Alive Interval TLV . . . . . . . . . . . . . . . 21 82 8. Security and Trust Management . . . . . . . . . . . . . . . . 22 83 8.1. Pre-Shared Key Based Trust Method . . . . . . . . . . . . 22 84 8.2. PKI Based Trust Method . . . . . . . . . . . . . . . . . 22 85 8.3. Certificate Based Trust Consensus Method . . . . . . . . 22 86 8.3.1. Trust Verdicts . . . . . . . . . . . . . . . . . . . 23 87 8.3.2. Trust Cache . . . . . . . . . . . . . . . . . . . . . 24 88 8.3.3. Announcement of Verdicts . . . . . . . . . . . . . . 24 89 8.3.4. Bootstrap Ceremonies . . . . . . . . . . . . . . . . 25 90 9. DNCP Profile-Specific Definitions . . . . . . . . . . . . . . 26 91 10. Security Considerations . . . . . . . . . . . . . . . . . . . 28 92 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28 93 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 29 94 12.1. Normative references . . . . . . . . . . . . . . . . . . 29 95 12.2. Informative references . . . . . . . . . . . . . . . . . 29 96 Appendix A. Alternative Modes of Operation . . . . . . . . . . . 29 97 A.1. Read-only Operation . . . . . . . . . . . . . . . . . . . 29 98 A.2. Forwarding Operation . . . . . . . . . . . . . . . . . . 30 99 Appendix B. Some Questions and Answers [RFC Editor: please 100 remove] . . . . . . . . . . . . . . . . . . . . . . 30 101 Appendix C. Changelog [RFC Editor: please remove] . . . . . . . 30 102 Appendix D. Draft Source [RFC Editor: please remove] . . . . . . 32 103 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 32 104 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 32 106 1. Introduction 108 DNCP is designed to provide a way for each participating node to 109 publish a set of TLV (Type-Length-Value) tuples, and to provide a 110 shared and common view about the data published by every currently or 111 recently bidirectionally reachable DNCP node in a network. 113 For state synchronization a hash tree is used. It is formed by first 114 calculating a hash for the dataset published by each node, called 115 node data, and then calculating another hash over those node data 116 hashes. The single resulting hash, called network state hash, is 117 transmitted using the Trickle algorithm [RFC6206] to ensure that all 118 nodes share the same view of the current state of the published data 119 within the network. The use of Trickle with only short network state 120 hashes sent infrequently (in steady state) makes DNCP very thrifty 121 when updates happen rarely. 123 For maintaining liveliness of the topology and the data within it, a 124 combination of Trickled network state, keep-alives, and "other" means 125 of ensuring reachability are used. The core idea is that if every 126 node ensures its peers are present, transitively, the whole network 127 state also stays up-to-date. 129 DNCP is most suitable for data that changes only infrequently to gain 130 the maximum benefit from using Trickle. As the network of nodes, or 131 the rate of data changes grows over a given time interval, Trickle is 132 eventually used less and less and the benefit of using DNCP 133 diminishes. In these cases Trickle just provides extra complexity 134 within the specification and little added value. If constant rapid 135 state changes are needed, the preferable choice is to use an 136 additional point-to-point channel whose address or locator is 137 published using DNCP. 139 2. Terminology 141 DNCP profile a definition of the set of rules and values 142 defining the behavior of a fully specified, 143 implementable protocol which uses DNCP. The DNCP 144 profile specifies transport method to be used, 145 which optional parts of the DNCP specification are 146 required by that particular protocol, and various 147 parameters and optional behaviors. In this 148 document any parameter that a DNCP profile 149 specifies is prefixed with DNCP_. Contents of a 150 DNCP profile are specified in Section 9. 152 DNCP-based a protocol which provides a DNCP profile, and 153 protocol potentially much more, e.g., protocol-specific TLVs 154 and guidance on how they should be used. 155 DNCP node a single node which runs a DNCP-based protocol. 157 Link a link-layer media over which directly connected 158 nodes can communicate. 159 DNCP network a set of DNCP nodes running the same DNCP-based 160 protocol. The set consists of nodes that have 161 discovered each other using the transport method 162 defined in the DNCP profile, via multicast on local 163 links, and/or by using unicast communication. 165 Node identifier an opaque fixed-length identifier consisting of 166 DNCP_NODE_IDENTIFIER_LENGTH bytes which uniquely 167 identifies a DNCP node within a DNCP network. 169 Interface a node's attachment to a particular link. 171 Address As DNCP itself is relatively transport agnostic, an 172 address in this specification denotes just 173 something that identifies an endpoint used by the 174 transport protocol that is used by a DNCP-based 175 protocol. In case of an IPv6 UDP transport, an 176 address in this specification refers to a tuple 177 (IPv6 address, UDP port). 178 Endpoint a locally configured communication endpoint of a 179 DNCP node, such as a network socket. An endpoint 180 may be bound to a set of predefined unicast 181 Addresses representing remote DNCP nodes to 182 individually connect to or to accept connections 183 from whereby communication with each node is 184 separated (e.g., an individual unicast UDP message 185 flow per remote node). An endpoint may also be 186 bound to a whole network interface, then multicast 187 communication is used (in addition to individual 188 unicast flows) to send certain messages to all DNCP 189 nodes connected therewith at once as well as to 190 automatically discover new DNCP nodes. Endpoints 191 are usually in one of the transport modes specified 192 in Section 4.2. 194 Endpoint a 32-bit opaque value, which identifies a 195 identifier particular endpoint of a particular DNCP node. The 196 value 0 is reserved for DNCP and DNCP-based 197 protocol purposes and not used to identify an 198 actual endpoint. This definition is in sync with 199 the interface index definition in [RFC3493], as the 200 non-zero small positive integers should comfortably 201 fit within 32 bits. 203 Peer another DNCP node with which a DNCP node 204 communicates using a particular local and remote 205 endpoint pair. 207 Node data a set of TLVs published and owned by a node in the 208 DNCP network. Other nodes pass it along as-is, even 209 if they cannot fully interpret it. 211 Node state a set of metadata attributes for node data. It 212 includes a sequence number for versioning, a hash 213 value for comparing equality of stored node data, 214 and a timestamp indicating the time passed since 215 its last publication. The hash function and the 216 length of the hash value are defined in the DNCP 217 profile. 219 Network state a hash value which represents the current state of 220 hash the network. The hash function and the length of 221 the hash value are defined in the DNCP profile. 222 Whenever a node is added, removed or updates its 223 published node data this hash value changes as 224 well. For calculation, please see Section 4.1. 226 Trust verdict a statement about the trustworthiness of a 227 certificate announced by a node participating in 228 the certificate based trust consensus mechanism. 230 Effective trust the trust verdict with the highest priority within 231 verdict the set of trust verdicts announced for the 232 certificate in the DNCP network. 234 Topology graph the undirected graph of DNCP nodes produced by 235 retaining only bidirectional peer relationships 236 between nodes. 238 2.1. Requirements Language 240 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 241 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 242 "OPTIONAL" in this document are to be interpreted as described in RFC 243 2119 [RFC2119]. 245 3. Overview 247 DNCP operates primarily using unicast exchanges between nodes, and 248 may use multicast for Trickle-based shared state dissemination and 249 topology discovery. If used in pure unicast mode with unreliable 250 transport, Trickle is also used between peers. 252 DNCP discovers the topology of its nodes and maintains the liveliness 253 of published node data by ensuring that the publishing node was - at 254 least recently - bidirectionally reachable. This is determined, 255 e.g., by a recent and consistent multicast or unicast TLV exchange 256 with its peers. New potential peers can be discovered autonomously 257 on multicast-enabled links, their addresses may be manually 258 configured or they may be found by some other means defined in a 259 later specification. 261 A hash tree is maintained by each node to represent the state of all 262 currently reachable nodes and the Trickle algorithm is used to 263 trigger synchronization. The need to check peer nodes for state 264 changes is thereby determined by comparing the current root of their 265 respective trees, i.e., their individually calculated network state 266 hashes. 268 Before joining a DNCP network, a node starts with a hash tree (and 269 therefore a calculated network state hash) only consisting of the 270 node itself. It then announces said hash by means of the Trickle 271 algorithm on all its configured endpoints. 273 When an update is detected by a node (e.g., by receiving a different 274 network state hash from a peer) the originator of the event is 275 requested to provide a list of the state of all nodes, i.e., all the 276 information it uses to calculate its own hash tree. The node uses 277 the list to determine whether its own information is outdated and - 278 if necessary - requests the actual node data that has changed. 280 Whenever a node's local copy of any node data and its hash tree are 281 updated (e.g., due to its own or another node's node state changing 282 or due to a peer being added or removed) its Trickle instances are 283 reset which eventually causes any update to be propagated to all of 284 its peers. 286 4. Operation 288 4.1. Hash Tree 290 Each DNCP node maintains an arbitrary width hash tree of height 1. 291 Each leaf represents one recently bidirectionally reachable DNCP node 292 (see Section 4.6), and is represented by a tuple consisting of the 293 node's sequence number in network byte order concatenated with the 294 hash-value of the node's ordered node data published in the Node 295 State TLV (Section 7.2.3). These leaves are ordered in ascending 296 order of the respective node identifiers. The root of the tree - the 297 network state hash - is represented by the hash-value calculated over 298 all such leaf tuples concatenated in order. It is used to determine 299 whether the view of the network of two or more nodes is consistent 300 and shared. 302 The node data hashes in the leaves and the root network state hash 303 are updated on-demand and whenever any locally stored per-node state 304 changes. This includes local unidirectional reachability encoded in 305 the published Peer TLVs (Section 7.3.1) and - when combined with 306 remote data - results in awareness of bidirectional reachability 307 changes. 309 4.2. Data Transport 311 DNCP has relatively few requirements for the underlying transport; it 312 requires some way of transmitting either unicast datagram or stream 313 data to a peer and, if used in multicast mode, a way of sending 314 multicast datagrams. As multicast is used only to identify potential 315 new DNCP nodes and to send status messages which merely notify that a 316 unicast exchange should be triggered, the multicast transport does 317 not have to be secured. If unicast security is desired and one of 318 the built-in security methods is to be used, support for some TLS- 319 derived transport scheme - such as TLS [RFC5246] on top of TCP or 320 DTLS [RFC6347] on top of UDP - is also required. A specific 321 definition of the transport(s) in use and their parameters MUST be 322 provided by the DNCP profile. 324 TLVs are sent across the transport as is, and they SHOULD be sent 325 together where, e.g., MTU considerations do not recommend sending 326 them in multiple batches. TLVs in general are handled individually 327 and statelessly, with one exception: To form bidirectional peer 328 relationships DNCP requires identification of the endpoints used for 329 communication. As bidirectional peer relationships are required for 330 validating liveliness of published node data as described in 331 Section 4.6, a DNCP node MUST send a Node Endpoint TLV 332 (Section 7.2.1). When it is sent varies, depending on the underlying 333 transport, but conceptually it should be available whenever 334 processing a Network State TLV: 336 o If using a stream transport, the TLV MUST be sent at least once 337 per connection, but SHOULD NOT be sent more than once. 339 o If using a datagram transport, it MUST be included in every 340 datagram that also contains a Network State TLV (Section 7.2.2) 341 and MUST be located before any such TLV. It SHOULD also be 342 included in any other datagram, to speeds up initial peer 343 detection. 345 Given the assorted transport options as well as potential endpoint 346 configuration, a DNCP endpoint may be used in various transport 347 modes: 349 Unicast: 351 * If only reliable unicast transport is used, Trickle is not used 352 at all. Where Trickle reset has been specified, a single 353 Network State TLV (Section 7.2.2) is sent instead to every 354 unicast peer. Additionally, recently changed Node State TLVs 355 (Section 7.2.3) MAY be included. 357 * If only unreliable unicast transport is used, Trickle state is 358 kept per peer and it is used to send Network State TLVs 359 intermittently, as specified in Section 4.3. 361 Multicast+Unicast: If multicast datagram transport is available on 362 an endpoint, Trickle state is only maintained for the endpoint as 363 a whole. It is used to send Network State TLVs every now and 364 then, as specified in Section 4.3. Additionally, per-endpoint 365 keep-alives MAY be defined in the DNCP profile, as specified in 366 Section 6.1.2. 368 MulticastListen+Unicast: Just like Unicast, except multicast 369 transmissions are listened to in order to detect changes of the 370 highest node identifier. This mode is used only if the DNCP 371 profile supports dense broadcast link optimization (Section 6.2). 373 4.3. Trickle-Driven Status Updates 375 The Trickle algorithm [RFC6206] has 3 parameters: Imin, Imax and k. 376 Imin and Imax represent the minimum and maximum values for I, which 377 is the time interval during which at least k Trickle updates must be 378 seen on an endpoint to prevent local state transmission. The actual 379 suggested Trickle algorithm parameters are DNCP profile specific, as 380 described in Section 9. 382 The Trickle state for all Trickle instances is considered 383 inconsistent and reset if and only if the locally calculated network 384 state hash changes. This occurs either due to a change in the local 385 node's own node data, or due to receipt of more recent data from 386 another node. A node MUST NOT reset its Trickle state merely based 387 on receiving a Network State TLV (Section 7.2.2) with a network state 388 hash which is different from its locally calculated one. 390 Every time a particular Trickle instance indicates that an update 391 should be sent, the node MUST send a Network State TLV 392 (Section 7.2.2) if and only if: 394 o the endpoint is in Multicast+Unicast transport mode, in which case 395 the TLV MUST be sent over multicast. 397 o the endpoint is NOT in Multicast+Unicast transport mode, and the 398 unicast transport is unreliable, in which case the TLV MUST be 399 sent over unicast. 401 A (sub)set of all Node State TLVs (Section 7.2.3) MAY also be 402 included, unless it is defined as undesirable for some reason by the 403 DNCP profile, or to avoid exposure of the node state TLVs by 404 transmitting them within insecure multicast when using secure 405 unicast. 407 4.4. Processing of Received TLVs 409 This section describes how received TLVs are processed. The DNCP 410 profile may specify when to ignore particular TLVs, e.g., to modify 411 security properties - see Section 9 for what may be safely defined to 412 be ignored in a profile. Any 'reply' mentioned in the steps below 413 denotes sending of the specified TLV(s) over unicast to the 414 originator of the TLV being processed. If the TLV being replied to 415 was received via multicast and it was sent to a multiple access link, 416 the reply SHOULD be delayed by a random timespan in [0, Imin/2], to 417 avoid potential simultaneous replies that may cause problems on some 418 links. Sending of replies MAY also be rate-limited or omitted for a 419 short period of time by an implementation. However, an 420 implementation MUST eventually reply to similar repeated requests, as 421 otherwise state synchronization breaks. 423 A DNCP node MUST process TLVs received from any valid address, as 424 specified by the DNCP profile and the configuration of a particular 425 endpoint, whether this address is known to be the address of a peer 426 or not. This provision satisfies the needs of monitoring or other 427 host software that needs to discover the DNCP topology without adding 428 to the state in the network. 430 Upon receipt of: 432 o Request Network State TLV (Section 7.1.1): The receiver MUST reply 433 with a Network State TLV (Section 7.2.2) and a Node State TLV 434 (Section 7.2.3) for each node data used to calculate the network 435 state hash. The Node State TLVs SHOULD NOT contain the optional 436 node data part to avoid redundant transmission of node data, 437 unless explicitly specified in the DNCP profile. 439 o Request Node State TLV (Section 7.1.2): If the receiver has node 440 data for the corresponding node, it MUST reply with a Node State 441 TLV (Section 7.2.3) for the corresponding node. The optional node 442 data part MUST be included in the TLV. 444 o Network State TLV (Section 7.2.2): If the network state hash 445 differs from the locally calculated network state hash, and the 446 receiver is unaware of any particular node state differences with 447 the sender, the receiver MUST reply with a Request Network State 448 TLV (Section 7.1.1). These replies MUST be rate limited to only 449 at most one reply per link per unique network state hash within 450 Imin. The simplest way to ensure this rate limit is a timestamp 451 indicating requests, and sending at most one Request Network State 452 TLV (Section 7.1.1) per Imin. To facilitate faster state 453 synchronization, if a Request Network State TLV is sent in a 454 reply, a local, current Network State TLV MAY also be sent. 456 o Node State TLV (Section 7.2.3): 458 * If the node identifier matches the local node identifier and 459 the TLV has a greater sequence number than its current local 460 value, or the same sequence number and a different hash, the 461 node SHOULD re-publish its own node data with a sequence number 462 significantly (e.g., 1000) greater than the received one, to 463 reclaim the node identifier. This difference is needed in 464 order to ensure that it is higher then any potentially 465 lingering copies of the node state in the network. This may 466 occur normally once due to the local node restarting and not 467 storing the most recently used sequence number. If this occurs 468 more than once or for nodes not re-publishing their own node 469 data, the DNCP profile MUST provide guidance on how to handle 470 these situations as it indicates the existence of another 471 active node with the same node identifier. 473 * If the node identifier does not match the local node 474 identifier, and one or more of the following conditions are 475 true: 477 + The local information is outdated for the corresponding node 478 (local sequence number is less than that within the TLV). 480 + The local information is potentially incorrect (local 481 sequence number matches but the node data hash differs). 483 + There is no data for that node altogether. 485 Then: 487 + If the TLV contains the Node Data field, it SHOULD also be 488 verified by ensuring that the locally calculated H(Node 489 Data) matches the content of the H(Node Data) field within 490 the TLV. If they differ, the TLV SHOULD be ignored and not 491 processed further. 493 + If the TLV does not contain the Node Data field, and the 494 H(Node Data) field within the TLV differs from the local 495 node data hash for that node (or there is none), the 496 receiver MUST reply with a Request Node State TLV 497 (Section 7.1.2) for the corresponding node. 499 + Otherwise the receiver MUST update its locally stored state 500 for that node (node data based on Node Data field if 501 present, sequence number and relative time) to match the 502 received TLV. 504 For comparison purposes of the sequence number, a looping 505 comparison function MUST be used to avoid problems in case of 506 overflow. The comparison function a < b <=> ((a - b) % (2^32)) & 507 (2^31) != 0 where (a % b) represents the remainder of a modulo b 508 and (a & b) represents bitwise conjunction of a and b is 509 RECOMMENDED unless the DNCP profile defines another. 511 o Any other TLV: TLVs not recognized by the receiver MUST be 512 silently ignored unless they are sent within another TLV (for 513 example, TLVs within the Node Data field of a Node State TLV). 515 If secure unicast transport is configured for an endpoint, any Node 516 State TLVs received over insecure multicast MUST be silently ignored. 518 4.5. Adding and Removing Peers 520 When receiving a Node Endpoint TLV (Section 7.2.1) on an endpoint 521 from an unknown peer: 523 o If received over unicast, the remote node MUST be added as a peer 524 on the endpoint and a Peer TLV (Section 7.3.1) MUST be created for 525 it. 527 o If received over multicast, the node MAY be sent a (possibly rate- 528 limited) unicast Request Network State TLV (Section 7.1.1). 530 If keep-alives specified in Section 6.1 are NOT sent by the peer 531 (either the DNCP profile does not specify the use of keep-alives or 532 the particular peer chooses not to send keep-alives), some other 533 existing local transport-specific means (such as Ethernet carrier- 534 detection or TCP keep-alive) MUST be used to ensure its presence. 535 When the peer is no longer present, the Peer TLV and the local DNCP 536 peer state MUST be removed. 538 If the local endpoint is in the Multicast-Listen+Unicast transport 539 mode, a Peer TLV (Section 7.3.1) MUST NOT be published for the peers 540 not having the highest node identifier. 542 4.6. Data Liveliness Validation 544 The topology graph MUST be traversed either immediately or with a 545 small delay shorter than the DNCP profile-defined Trickle Imin, 546 whenever: 548 o A Peer TLV or a whole node is added or removed, or 550 o the origination time (in milliseconds) of some node's node data is 551 less than current time - 2^32 + 2^15. 553 The topology graph traversal starts with the local node marked as 554 reachable. Other nodes are then iteratively marked as reachable 555 using the following algorithm: A candidate not-yet-reachable node N 556 with an endpoint NE is marked as reachable if there is a reachable 557 node R with an endpoint RE that meet all of the following criteria: 559 o The origination time (in milliseconds) of R's node data is greater 560 than current time in - 2^32 + 2^15. 562 o R publishes a Peer TLV with: 564 * Peer Node Identifier = N's node identifier 566 * Peer Endpoint Identifier = NE's endpoint identifier 568 * Endpoint Identifier = RE's endpoint identifier 570 o N publishes a Peer TLV with: 572 * Peer Node Identifier = R's node identifier 574 * Peer Endpoint Identifier = RE's endpoint identifier 576 * Endpoint Identifier = NE's endpoint identifier 578 The algorithm terminates, when no more candidate nodes fulfilling 579 these criteria can be found. 581 DNCP nodes that have not been reachable in the most recent topology 582 graph traversal MUST NOT be used for calculation of the network state 583 hash, be provided to any applications that need to use the whole TLV 584 graph, or be provided to remote nodes. They MAY be removed 585 immediately after the topology graph traversal, however it is 586 RECOMMENDED to keep them at least briefly to improve the speed of 587 DNCP network state convergence and to reduce the number of redundant 588 state transmissions between nodes. 590 5. Data Model 592 This section describes the local data structures a minimal 593 implementation might use. This section is provided only as a 594 convenience for the implementor. Some of the optional extensions 595 (Section 6) describe additional data requirements, and some optional 596 parts of the core protocol may also require more. 598 A DNCP node has: 600 o A data structure containing data about the most recently sent 601 Request Network State TLVs (Section 7.1.1). The simplest option 602 is keeping a timestamp of the most recent request (required to 603 fulfill reply rate limiting specified in Section 4.4). 605 A DNCP node has for every DNCP node in the DNCP network: 607 o Node identifier: the unique identifier of the node. The length, 608 how it is produced, and how collisions are handled, is up to the 609 DNCP profile. 611 o Node data: the set of TLV tuples published by that particular 612 node. As they are transmitted ordered (see Node State TLV 613 (Section 7.2.3) for details), maintaining the order within the 614 data structure here may be reasonable. 616 o Latest sequence number: the 32-bit sequence number that is 617 incremented any time the TLV set is published. The comparison 618 function used to compare them is described in Section 4.4. 620 o Origination time: the (estimated) time when the current TLV set 621 with the current sequence number was published. It is used to 622 populate the Milliseconds Since Origination field in a Node State 623 TLV (Section 7.2.3). Ideally it also has millisecond accuracy. 625 Additionally, a DNCP node has a set of endpoints for which DNCP is 626 configured to be used. For each such endpoint, a node has: 628 o Endpoint identifier: the 32-bit opaque value uniquely identifying 629 the endpoint within the local node. It SHOULD NOT be reused 630 immediately after an endpoint is disabled. 632 o Trickle instance: the endpoint's Trickle instance with parameters 633 I, T, and c (only on an endpoint in Multicast+Unicast transport 634 mode). 636 and one (or more) of the following: 638 o Interface: the assigned local network interface. 640 o Unicast address: the DNCP node it should connect with. 642 o Set of addresses: the DNCP nodes from which connections are 643 accepted. 645 For each remote (peer, endpoint) pair detected on a local endpoint, a 646 DNCP node has: 648 o Node identifier: the unique identifier of the peer. 650 o Endpoint identifier: the unique endpoint identifier used by the 651 peer. 653 o Peer address: the most recently used address of the peer 654 (authenticated and authorized, if security is enabled). 656 o Trickle instance: the particular peer's Trickle instance with 657 parameters I, T, and c (only on an endpoint in Unicast mode, when 658 using an unreliable unicast transport) . 660 6. Optional Extensions 662 This section specifies extensions to the core protocol that a DNCP 663 profile may specify to be used. 665 6.1. Keep-Alives 667 Trickle-driven status updates (Section 4.3) provide a mechanism for 668 handling of new peer detection on an endpoint, as well as state 669 change notifications. Another mechanism may be needed to get rid of 670 old, no longer valid peers if the transport or lower layers do not 671 provide one. 673 If keep-alives are not specified in the DNCP profile, the rest of 674 this subsection MUST be ignored. 676 A DNCP profile MAY specify either per-endpoint (sent using multicast 677 to all DNCP nodes connected to a multiple access link) or per-peer 678 (sent using unicast to each peer individually) keep-alive support. 680 For every endpoint that a keep-alive is specified for in the DNCP 681 profile, the endpoint-specific keep-alive interval MUST be 682 maintained. By default, it is DNCP_KEEPALIVE_INTERVAL. If there is 683 a local value that is preferred for that for any reason 684 (configuration, energy conservation, media type, ..), it can be 685 substituted instead. If a non-default keep-alive interval is used on 686 any endpoint, a DNCP node MUST publish appropriate Keep-Alive 687 Interval TLV(s) (Section 7.3.2) within its node data. 689 6.1.1. Data Model Additions 691 The following additions to the Data Model (Section 5) are needed to 692 support keep-alives: 694 For each configured endpoint that has per-endpoint keep-alives 695 enabled: 697 o Last sent: If a timestamp which indicates the last time a Network 698 State TLV (Section 7.2.2) was sent over that interface. 700 For each remote (peer, endpoint) pair detected on a local endpoint, a 701 DNCP node has: 703 o Last contact timestamp: a timestamp which indicates the last time 704 a consistent Network State TLV (Section 7.2.2) was received from 705 the peer over multicast, or anything was received over unicast. 706 When adding a new peer, it is initialized to the current time. 708 o Last sent: If per-peer keep-alives are enabled, a timestamp which 709 indicates the last time a Network State TLV (Section 7.2.2) was 710 sent to to that point-to-point peer. When adding a new peer, it 711 is initialized to the current time. 713 6.1.2. Per-Endpoint Periodic Keep-Alives 715 If per-endpoint keep-alives are enabled on an endpoint in 716 Multicast+Unicast transport mode, and if no traffic containing a 717 Network State TLV (Section 7.2.2) has been sent to a particular 718 endpoint within the endpoint-specific keep-alive interval, a Network 719 State TLV (Section 7.2.2) MUST be sent on that endpoint, and a new 720 Trickle interval started, as specified in the step 2 of Section 4.2 721 of [RFC6206]. The actual sending time SHOULD be further delayed by a 722 random timespan in [0, Imin/2]. 724 6.1.3. Per-Peer Periodic Keep-Alives 726 If per-peer keep-alives are enabled on a unicast-only endpoint, and 727 if no traffic containing a Network State TLV (Section 7.2.2) has been 728 sent to a particular peer within the endpoint-specific keep-alive 729 interval, a Network State TLV (Section 7.2.2) MUST be sent to the 730 peer, and a new Trickle interval started, as specified in the step 2 731 of Section 4.2 of [RFC6206]. 733 6.1.4. Received TLV Processing Additions 735 If a TLV is received over unicast from the peer, the Last contact 736 timestamp for the peer MUST be updated. 738 On receipt of a Network State TLV (Section 7.2.2) which is consistent 739 with the locally calculated network state hash, the Last contact 740 timestamp for the peer MUST be updated. 742 6.1.5. Peer Removal 744 For every peer on every endpoint, the endpoint-specific keep-alive 745 interval must be calculated by looking for Keep-Alive Interval TLVs 746 (Section 7.3.2) published by the node, and if none exist, using the 747 default value of DNCP_KEEPALIVE_INTERVAL. If the peer's last contact 748 timestamp has not been updated for at least locally chosen 749 potentially endpoint-specific keep-alive multiplier (defaults to 750 DNCP_KEEPALIVE_MULTIPLIER) times the peer's endpoint-specific keep- 751 alive interval, the Peer TLV for that peer and the local DNCP peer 752 state MUST be removed. 754 6.2. Support For Dense Broadcast Links 756 This optimization is needed to avoid a state space explosion. Given 757 a large set of DNCP nodes publishing data on an endpoint that uses 758 multicast on a link, every node will add a Peer TLV (Section 7.3.1) 759 for each peer. While Trickle limits the amount of traffic on the 760 link in stable state to some extent, the total amount of data that is 761 added to and maintained in the DNCP network given N nodes on a 762 multicast-enabled link is O(N^2). Additionally if per-peer keep- 763 alives are used, there will be O(N^2) keep-alives running on the link 764 if liveliness of peers is not ensured using some other way (e.g., TCP 765 connection lifetime, layer 2 notification, per-endpoint keep-alive). 767 An upper bound for the number of peers that are allowed for a 768 particular type of link that an endpoint in Multicast+Unicast 769 transport mode is used on SHOULD be provided by a DNCP profile, but 770 MAY also be chosen at runtime. Main consideration when selecting a 771 bound (if any) for a particular type of link should be whether it 772 supports broadcast traffic, and whether a too large number of peers 773 case is likely to happen during the use of that DNCP profile on that 774 particular type of link. If neither is likely, there is little point 775 specifying support for this for that particular link type. 777 If a DNCP profile does not support this extension at all, the rest of 778 this subsection MUST be ignored. This is because when this extension 779 is used, the state within the DNCP network only contains a subset of 780 the full topology of the network. Therefore every node must be aware 781 of the potential of it being used in a particular DNCP profile. 783 If the specified upper bound is exceeded for some endpoint in 784 Multicast+Unicast transport mode and if the node does not have the 785 highest node identifier on the link, it SHOULD treat the endpoint as 786 a unicast endpoint connected to the node that has the highest node 787 identifier detected on the link, therefore transitioning to 788 Multicast-listen+Unicast transport mode. See Section 4.2 for 789 implications on the specific endpoint behavior. The nodes in 790 Multicast-listen+Unicast transport mode MUST keep listening to 791 multicast traffic to both receive messages from the node(s) still in 792 Multicast+Unicast mode, and as well to react to nodes with a greater 793 node identifier appearing. If the highest node identifier present on 794 the link changes, the remote unicast address of the endpoints in 795 Multicast-Listen+Unicast transport mode MUST be changed. If the node 796 identifier of the local node is the highest one, the node MUST switch 797 back to, or stay in Multicast+Unicast mode, and normally form peer 798 relationships with all peers. 800 7. Type-Length-Value Objects 802 Each TLV is encoded as a 2 byte type field, followed by a 2 byte 803 length field (of the value excluding header, in bytes, 0 meaning no 804 value) followed by the value itself, if any. Both type and length 805 fields in the header as well as all integer fields inside the value - 806 unless explicitly stated otherwise - are represented in network byte 807 order. Padding bytes with value zero MUST be added up to the next 4 808 byte boundary if the length is not divisible by 4. These padding 809 bytes MUST NOT be included in the number stored in the length field. 810 Each TLV which does not define optional fields or variable-length 811 content MAY be sent with additional nested TLVs appended after the 812 required TLV fields - and padding (if applicable) to allow for 813 extensibility. In this case the length field includes the length of 814 the original TLV, the length of the padding that are inserted before 815 the embedded TLVs and the length of the added TLVs. Therefore, each 816 node MUST accept received TLVs that are longer than the fixed fields 817 specified and ignore embedded TLVs it does not understand. 819 0 1 2 3 820 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 821 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 822 | Type | Length | 823 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 824 | Value | 825 .. 826 | (variable # of bytes) | 827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 828 | (Optional nested TLVs) | 829 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 831 For example, type=123 (0x7b) TLV with value 'x' (120 = 0x78) is 832 encoded as: 007B 0001 7800 0000. If it were to have sub-TLV of 833 type=124 (0x7c) with value 'y', it would be encoded as 007B 0009 7800 834 0000 007C 0001 7900 0000. 836 In this section, the following special notation is used: 838 .. = octet string concatenation operation. 840 H(x) = non-cryptographic hash function specified by DNCP profile. 842 7.1. Request TLVs 844 7.1.1. Request Network State TLV 846 0 1 2 3 847 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 848 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 849 | Type: REQ-NETWORK-STATE (1) | Length: >= 0 | 850 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 852 This TLV is used to request response with a Network State TLV 853 (Section 7.2.2) and all Node State TLVs (Section 7.2.3) (without node 854 data). 856 7.1.2. Request Node State TLV 858 0 1 2 3 859 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 860 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 861 | Type: REQ-NODE-STATE (2) | Length: > 0 | 862 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 863 | Node Identifier | 864 | (length fixed in DNCP profile) | 865 ... 866 | | 867 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 869 This TLV is used to request a Node State TLV (Section 7.2.3) 870 (including node data) for the node with the matching node identifier. 872 7.2. Data TLVs 874 7.2.1. Node Endpoint TLV 876 0 1 2 3 877 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 878 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 879 | Type: NODE-ENDPOINT (3) | Length: > 4 | 880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 881 | Node Identifier | 882 | (length fixed in DNCP profile) | 883 ... 884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 885 | Endpoint Identifier | 886 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 888 This TLV identifies both the local node's node identifier, as well as 889 the particular endpoint's endpoint identifier. Section 4.2 specifies 890 when it is sent. 892 7.2.2. Network State TLV 894 0 1 2 3 895 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 896 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 897 | Type: NETWORK-STATE (4) | Length: > 0 | 898 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 899 | H(sequence number of node 1 .. H(node data of node 1) .. | 900 | .. sequence number of node N .. H(node data of node N)) | 901 | (length fixed in DNCP profile) | 902 ... 903 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 904 This TLV contains the current locally calculated network state hash, 905 see Section 4.1 for how it is calculated. 907 7.2.3. Node State TLV 909 0 1 2 3 910 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 911 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 912 | Type: NODE-STATE (5) | Length: > 8 | 913 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 914 | Node Identifier | 915 | (length fixed in DNCP profile) | 916 ... 917 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 918 | Sequence Number | 919 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 920 | Milliseconds Since Origination | 921 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 922 | H(Node Data) | 923 | (length fixed in DNCP profile) | 924 ... 925 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 926 | (optionally) Node Data (a set of nested TLVs) | 927 ... 928 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 930 This TLV represents the local node's knowledge about the published 931 state of a node in the DNCP network identified by the Node Identifier 932 field in the TLV. 934 Every node, including the originating one, MUST update the 935 Milliseconds Since Origination whenever it sends a Node State TLV 936 based on when the node estimates the data was originally published. 937 This is, e.g., to ensure that any relative timestamps contained 938 within the published node data can be correctly offset and 939 interpreted. Ultimately, what is provided is just an approximation, 940 as transmission delays are not accounted for. 942 Absent any changes, if the originating node notices that the 32-bit 943 milliseconds since origination value would be close to overflow 944 (greater than 2^32-2^16), the node MUST re-publish its TLVs even if 945 there is no change. In other words, absent any other changes, the 946 TLV set MUST be re-published roughly every 48 days. 948 The actual node data of the node may be included within the TLV as 949 well in the optional Node Data field. The set of TLVs MUST be 950 strictly ordered based on ascending binary content (including TLV 951 type and length). This enables, e.g., efficient state delta 952 processing and no-copy indexing by TLV type by the recipient. The 953 Node Data content MUST be passed along exactly as it was received. 954 It SHOULD be also verified on receipt that the locally calculated 955 H(Node Data) matches the content of the field within the TLV, and if 956 the hash differs, the TLV SHOULD be ignored. 958 7.3. Data TLVs within Node State TLV 960 These TLVs are published by the DNCP nodes, and therefore only 961 encoded within the Node State TLVs. If encountered outside Node 962 State TLV, they MUST be silently ignored. 964 7.3.1. Peer TLV 966 0 1 2 3 967 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 968 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 969 | Type: PEER (8) | Length: > 8 | 970 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 971 | Peer Node Identifier | 972 | (length fixed in DNCP profile) | 973 ... 974 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 975 | Peer Endpoint Identifier | 976 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 977 | Local Endpoint Identifier | 978 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 980 This TLV indicates that the node in question vouches that the 981 specified peer is reachable by it on the specified local endpoint. 982 The presence of this TLV at least guarantees that the node publishing 983 it has received traffic from the peer recently. For guaranteed up- 984 to-date bidirectional reachability, the existence of both nodes' 985 matching Peer TLVs needs to be checked. 987 7.3.2. Keep-Alive Interval TLV 989 0 1 2 3 990 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 991 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 992 | Type: KEEP-ALIVE-INTERVAL (9) | Length: >= 8 | 993 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 994 | Endpoint Identifier | 995 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 996 | Interval | 997 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 998 This TLV indicates a non-default interval being used to send keep- 999 alives specified in Section 6.1. 1001 Endpoint identifier is used to identify the particular endpoint for 1002 which the interval applies. If 0, it applies for ALL endpoints for 1003 which no specific TLV exists. 1005 Interval specifies the interval in milliseconds at which the node 1006 sends keep-alives. A value of zero means no keep-alives are sent at 1007 all; in that case, some lower layer mechanism that ensures presence 1008 of nodes MUST be available and used. 1010 8. Security and Trust Management 1012 If specified in the DNCP profile, either DTLS [RFC6347] or TLS 1013 [RFC5246] may be used to authenticate and encrypt either some (if 1014 specified optional in the profile), or all unicast traffic. The 1015 following methods for establishing trust are defined, but it is up to 1016 the DNCP profile to specify which ones may, should or must be 1017 supported. 1019 8.1. Pre-Shared Key Based Trust Method 1021 A PSK-based trust model is a simple security management mechanism 1022 that allows an administrator to deploy devices to an existing network 1023 by configuring them with a pre-defined key, similar to the 1024 configuration of an administrator password or WPA-key. Although 1025 limited in nature it is useful to provide a user-friendly security 1026 mechanism for smaller networks. 1028 8.2. PKI Based Trust Method 1030 A PKI-based trust-model enables more advanced management capabilities 1031 at the cost of increased complexity and bootstrapping effort. It 1032 however allows trust to be managed in a centralized manner and is 1033 therefore useful for larger networks with a need for an authoritative 1034 trust management. 1036 8.3. Certificate Based Trust Consensus Method 1038 The certificate-based consensus model is designed to be a compromise 1039 between trust management effort and flexibility. It is based on 1040 X.509-certificates and allows each DNCP node to provide a trust 1041 verdict on any other certificate and a consensus is found to 1042 determine whether a node using this certificate or any certificate 1043 signed by it is to be trusted. 1045 A DNCP node not using this security method MUST ignore all announced 1046 trust verdicts and MUST NOT announce any such verdicts by itself, 1047 i.e., any other normative language in this subsection does not apply 1048 to it. 1050 The current effective trust verdict for any certificate is defined as 1051 the one with the highest priority from all trust verdicts announced 1052 for said certificate at the time. 1054 8.3.1. Trust Verdicts 1056 Trust verdicts are statements of DNCP nodes about the trustworthiness 1057 of X.509-certificates. There are 5 possible trust verdicts in order 1058 of ascending priority: 1060 0 (Neutral): no trust verdict exists but the DNCP network should 1061 determine one. 1063 1 (Cached Trust): the last known effective trust verdict was 1064 Configured or Cached Trust. 1066 2 (Cached Distrust): the last known effective trust verdict was 1067 Configured or Cached Distrust. 1069 3 (Configured Trust): trustworthy based upon an external ceremony 1070 or configuration. 1072 4 (Configured Distrust): not trustworthy based upon an external 1073 ceremony or configuration. 1075 Trust verdicts are differentiated in 3 groups: 1077 o Configured verdicts are used to announce explicit trust verdicts a 1078 node has based on any external trust bootstrap or predefined 1079 relation a node has formed with a given certificate. 1081 o Cached verdicts are used to retain the last known trust state in 1082 case all nodes with configured verdicts about a given certificate 1083 have been disconnected or turned off. 1085 o The Neutral verdict is used to announce a new node intending to 1086 join the network so a final verdict for it can be found. 1088 The current effective trust verdict for any certificate is defined as 1089 the one with the highest priority within the set of trust verdicts 1090 announced for the certificate in the DNCP network. A node MUST be 1091 trusted for participating in the DNCP network if and only if the 1092 current effective trust verdict for its own certificate or any one in 1093 its certificate hierarchy is (Cached or Configured) Trust and none of 1094 the certificates in its hierarchy have an effective trust verdict of 1095 (Cached or Configured) Distrust. In case a node has a configured 1096 verdict, which is different from the current effective trust verdict 1097 for a certificate, the current effective trust verdict takes 1098 precedence in deciding trustworthiness. Despite that, the node still 1099 retains and announces its configured verdict. 1101 8.3.2. Trust Cache 1103 Each node SHOULD maintain a trust cache containing the current 1104 effective trust verdicts for all certificates currently announced in 1105 the DNCP network. This cache is used as a backup of the last known 1106 state in case there is no node announcing a configured verdict for a 1107 known certificate. It SHOULD be saved to a non-volatile memory at 1108 reasonable time intervals to survive a reboot or power outage. 1110 Every time a node (re)joins the network or detects the change of an 1111 effective trust verdict for any certificate, it will synchronize its 1112 cache, i.e., store new effective trust verdicts overwriting any 1113 previously cached verdicts. Configured verdicts are stored in the 1114 cache as their respective cached counterparts. Neutral verdicts are 1115 never stored and do not override existing cached verdicts. 1117 8.3.3. Announcement of Verdicts 1119 A node SHOULD always announce any configured trust verdicts it has 1120 established by itself, and it MUST do so if announcing the configured 1121 trust verdict leads to a change in the current effective trust 1122 verdict for the respective certificate. In absence of configured 1123 verdicts, it MUST announce cached trust verdicts it has stored in its 1124 trust cache, if one of the following conditions applies: 1126 o The stored trust verdict is Cached Trust and the current effective 1127 trust verdict for the certificate is Neutral or does not exist. 1129 o The stored trust verdict is Cached Distrust and the current 1130 effective trust verdict for the certificate is Cached Trust. 1132 A node rechecks these conditions whenever it detects changes of 1133 announced trust verdicts anywhere in the network. 1135 Upon encountering a node with a hierarchy of certificates for which 1136 there is no effective trust verdict, a node adds a Neutral Trust- 1137 Verdict-TLV to its node data for all certificates found in the 1138 hierarchy, and publishes it until an effective trust verdict 1139 different from Neutral can be found for any of the certificates, or a 1140 reasonable amount of time (10 minutes is suggested) with no reaction 1141 and no further authentication attempts has passed. Such trust 1142 verdicts SHOULD also be limited in rate and number to prevent denial- 1143 of-service attacks. 1145 Trust verdicts are announced using Trust-Verdict TLVs: 1147 0 1 2 3 1148 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1150 | Type: Trust-Verdict (10) | Length: > 36 | 1151 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1152 | Verdict | (reserved) | 1153 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1154 | | 1155 | | 1156 | | 1157 | SHA-256 Fingerprint | 1158 | | 1159 | | 1160 | | 1161 | | 1162 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1163 | Common Name | 1165 Verdict represents the numerical index of the trust verdict. 1167 (reserved) is reserved for future additions and MUST be set to 0 1168 when creating TLVs and ignored when parsing them. 1170 SHA-256 Fingerprint contains the SHA-256 [RFC6234] hash value of 1171 the certificate in DER-format. 1173 Common Name contains the variable-length (1-64 bytes) common name 1174 of the certificate. 1176 8.3.4. Bootstrap Ceremonies 1178 The following non-exhaustive list of methods describes possible ways 1179 to establish trust relationships between DNCP nodes and node 1180 certificates. Trust establishment is a two-way process in which the 1181 existing network must trust the newly added node and the newly added 1182 node must trust at least one of its peer nodes. It is therefore 1183 necessary that both the newly added node and an already trusted node 1184 perform such a ceremony to successfully introduce a node into the 1185 DNCP network. In all cases an administrator MUST be provided with 1186 external means to identify the node belonging to a certificate based 1187 on its fingerprint and a meaningful common name. 1189 8.3.4.1. Trust by Identification 1191 A node implementing certificate-based trust MUST provide an interface 1192 to retrieve the current set of effective trust verdicts, fingerprints 1193 and names of all certificates currently known and set configured 1194 trust verdicts to be announced. Alternatively it MAY provide a 1195 companion DNCP node or application with these capabilities with which 1196 it has a pre-established trust relationship. 1198 8.3.4.2. Preconfigured Trust 1200 A node MAY be preconfigured to trust a certain set of node or CA 1201 certificates. However such trust relationships MUST NOT result in 1202 unwanted or unrelated trust for nodes not intended to be run inside 1203 the same network (e.g., all other devices by the same manufacturer). 1205 8.3.4.3. Trust on Button Press 1207 A node MAY provide a physical or virtual interface to put one or more 1208 of its internal network interfaces temporarily into a mode in which 1209 it trusts the certificate of the first DNCP node it can successfully 1210 establish a connection with. 1212 8.3.4.4. Trust on First Use 1214 A node which is not associated with any other DNCP node MAY trust the 1215 certificate of the first DNCP node it can successfully establish a 1216 connection with. This method MUST NOT be used when the node has 1217 already associated with any other DNCP node. 1219 9. DNCP Profile-Specific Definitions 1221 Each DNCP profile MUST specify the following aspects: 1223 o Unicast and optionally multicast transport protocol(s) to be used. 1224 If multicast-based node and status discovery is desired, a 1225 datagram-based transport supporting multicast has to be available. 1227 o How the chosen transport(s) are secured: Not at all, optionally or 1228 always with the TLS scheme defined here using one or more of the 1229 methods, or with something else. If the links with DNCP nodes can 1230 be sufficiently secured or isolated, it is possible to run DNCP in 1231 a secure manner without using any form of authentication or 1232 encryption. 1234 o Transport protocols' parameters such as port numbers to be used, 1235 or multicast address to be used. Unicast, multicast, and secure 1236 unicast may each require different parameters, if applicable. 1238 o When receiving TLVs, what sort of TLVs are ignored in addition - 1239 as specified in Section 4.4 - e.g., for security reasons. A DNCP 1240 profile may safely define the following DNCP TLVs to be safely 1241 ignored: 1243 * Anything received over multicast, except Node Endpoint TLV 1244 (Section 7.2.1) and Network State TLV (Section 7.2.2). 1246 * Any TLVs received over unreliable unicast or multicast at too 1247 high rate; Trickle will ensure eventual convergence given the 1248 rate slows down at some point. 1250 o How to deal with node identifier collision as described in 1251 Section 4.4. Main options are either for one or both nodes to 1252 assign new node identifiers to themselves, or to notify someone 1253 about a fatal error condition in the DNCP network. 1255 o Imin, Imax and k ranges to be suggested for implementations to be 1256 used in the Trickle algorithm. The Trickle algorithm does not 1257 require these to be the same across all implementations for it to 1258 work, but similar orders of magnitude helps implementations of a 1259 DNCP profile to behave more consistently and to facilitate 1260 estimation of lower and upper bounds for convergence behavior of 1261 the network. 1263 o Hash function H(x) to be used, and how many bits of the output are 1264 actually used. The chosen hash function is used to handle both 1265 hashing of node specific data, and network state hash, which is a 1266 hash of node specific data hashes. SHA-256 defined in [RFC6234] 1267 is the recommended default choice, but a non-cryptographic hash 1268 function could be used as well. 1270 o DNCP_NODE_IDENTIFIER_LENGTH: The fixed length of a node identifier 1271 (in bytes). 1273 o Whether to send keep-alives, and if so, whether per-endpoint 1274 (requires multicast transport), or per-peer. Keep-alive has also 1275 associated parameters: 1277 * DNCP_KEEPALIVE_INTERVAL: How often keep-alives are to be sent 1278 by default (if enabled). 1280 * DNCP_KEEPALIVE_MULTIPLIER: How many times the 1281 DNCP_KEEPALIVE_INTERVAL (or peer-supplied keep-alive interval 1282 value) a node may not be heard from to be considered still 1283 valid. This is just a default used in absence of any other 1284 configuration information, or particular per-endpoint 1285 configuration. 1287 10. Security Considerations 1289 DNCP-based protocols may use multicast to indicate DNCP state changes 1290 and for keep-alive purposes. However, no actual published data TLVs 1291 will be sent across that channel. Therefore an attacker may only 1292 learn hash values of the state within DNCP and may be able to trigger 1293 unicast synchronization attempts between nodes on a local link this 1294 way. A DNCP node MUST therefore rate-limit its reactions to 1295 multicast packets. 1297 When using DNCP to bootstrap a network, PKI based solutions may have 1298 issues when validating certificates due to potentially unavailable 1299 accurate time, or due to inability to use the network to either check 1300 Certifcate Revocation Lists or perform on-line validation. 1302 The Certificate-based trust consensus mechanism defined in this 1303 document allows for a consenting revocation, however in case of a 1304 compromised device the trust cache may be poisoned before the actual 1305 revocation happens allowing the distrusted device to rejoin the 1306 network using a different identity. Stopping such an attack might 1307 require physical intervention and flushing of the trust caches. 1309 11. IANA Considerations 1311 IANA should set up a registry for DNCP TLV types, with the following 1312 initial contents: 1314 0: Reserved 1316 1: Request network state 1318 2: Request node state 1320 3: Node endpoint 1322 4: Network state 1324 5: Node state 1326 6: Reserved (was: Custom) 1328 7: Reserved (was: Fragment count) 1330 8: Peer 1332 9: Keep-alive interval 1334 10: Trust-Verdict 1335 32-191: Reserved for per-DNCP profile use 1337 192-255: Reserved for per-implementation experimentation. How 1338 collision is avoided is out of scope of this document. 1340 For the rest of the values (11-31, 256-65535), policy of 'standards 1341 action' should be used. 1343 12. References 1345 12.1. Normative references 1347 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1348 Requirement Levels", BCP 14, RFC 2119, March 1997. 1350 [RFC6206] Levis, P., Clausen, T., Hui, J., Gnawali, O., and J. Ko, 1351 "The Trickle Algorithm", RFC 6206, March 2011. 1353 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 1354 Security Version 1.2", RFC 6347, January 2012. 1356 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1357 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1359 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1360 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 1362 12.2. Informative references 1364 [RFC3493] Gilligan, R., Thomson, S., Bound, J., McCann, J., and W. 1365 Stevens, "Basic Socket Interface Extensions for IPv6", RFC 1366 3493, February 2003. 1368 Appendix A. Alternative Modes of Operation 1370 Beyond what is described in the main text, the protocol allows for 1371 other uses. These are provided as examples. 1373 A.1. Read-only Operation 1375 If a node uses just a single endpoint and does not need to publish 1376 any TLVs, full DNCP node functionality is not required. Such limited 1377 node can acquire and maintain view of the TLV space by implementing 1378 the processing logic as specified in Section 4.4. Such node would 1379 not need Trickle, peer-maintenance or even keep-alives at all, as the 1380 DNCP nodes' use of it would guarantee eventual receipt of network 1381 state hashes, and synchronization of node data, even in presence of 1382 unreliable transport. 1384 A.2. Forwarding Operation 1386 If a node with a pair of endpoints does not need to publish any TLVs, 1387 it can detect (for example) nodes with the highest node identifier on 1388 each of the endpoints (if any). Any TLVs received from one of them 1389 would be forwarded verbatim as unicast to the other node with highest 1390 node identifier. 1392 Any tinkering with the TLVs would remove guarantees of this scheme 1393 working; however passive monitoring would obviously be fine. This 1394 type of simple forwarding cannot be chained, as it does not send 1395 anything proactively. 1397 Appendix B. Some Questions and Answers [RFC Editor: please remove] 1399 Q: 32-bit endpoint id? 1401 A: Here, it would save 32 bits per peer if it was 16 bits (and less 1402 is not realistic). However, TLVs defined elsewhere would not seem to 1403 even gain that much on average. 32 bits is also used for ifindex in 1404 various operating systems, making for simpler implementation. 1406 Q: Why have topology information at all? 1408 A: It is an alternative to the more traditional seq#/TTL-based 1409 flooding schemes. In steady state, there is no need to, e.g., re- 1410 publish every now and then. 1412 Appendix C. Changelog [RFC Editor: please remove] 1414 draft-ietf-homenet-dncp-08: 1416 o Removed fragmentation as it is somewhat underspecified and 1417 unimplemented. It may be specified in some future extension draft 1418 or new version of DNCP. 1420 o Added generic sub-TLV extensibility mechanism. 1422 draft-ietf-homenet-dncp-06: 1424 o Removed custom TLV. 1426 o Made keep-alive multipliers local implementation choice, profiles 1427 just provide guidance on sane default value. 1429 o Removed the DNCP_GRACE_INTERVAL as it is really implementation 1430 choice. 1432 o Simplified the suggested structures in data model. 1434 o Reorganized the document and provided an overview section. 1436 draft-ietf-homenet-dncp-04: 1438 o Added mandatory rate limiting for network state requests, and 1439 optional slightly faster convergence mechanism by including 1440 current local network state in the remote network state requests. 1442 draft-ietf-homenet-dncp-03: 1444 o Renamed connection -> endpoint. 1446 o !!! Backwards incompatible change: Renumbered TLVs, and got rid of 1447 node data TLV; instead, node data TLV's contents are optionally 1448 within node state TLV. 1450 draft-ietf-homenet-dncp-02: 1452 o Changed DNCP "messages" into series of TLV streams, allowing 1453 optimized round-trip saving synchronization. 1455 o Added fragmentation support for bigger node data and for chunking 1456 in absence of reliable L2 and L3 fragmentation. 1458 draft-ietf-homenet-dncp-01: 1460 o Fixed keep-alive semantics to consider unicast requests also 1461 updates of most recently consistent, and added proactive unicast 1462 request to ensure even inconsistent keep-alive messages eventually 1463 triggering consistency timestamp update. 1465 o Facilitated (simple) read-only clients by making Node Connection 1466 TLV optional if just using DNCP for read-only purposes. 1468 o Added text describing how to deal with "dense" networks, but left 1469 actual numbers and mechanics up to DNCP profiles and (local) 1470 configurations. 1472 draft-ietf-homenet-dncp-00: Split from pre-version of draft-ietf- 1473 homenet-hncp-03 generic parts. Changes that affect implementations: 1475 o TLVs were renumbered. 1477 o TLV length does not include header (=-4). This facilitates, e.g., 1478 use of DHCPv6 option parsing libraries (same encoding), and 1479 reduces complexity (no need to handle error values of length less 1480 than 4). 1482 o Trickle is reset only when locally calculated network state hash 1483 is changes, not as remote different network state hash is seen. 1484 This prevents, e.g., attacks by multicast with one multicast 1485 packet to force Trickle reset on every interface of every node on 1486 a link. 1488 o Instead of 'ping', use 'keep-alive' (optional) for dead peer 1489 detection. Different message used! 1491 Appendix D. Draft Source [RFC Editor: please remove] 1493 As usual, this draft is available at https://github.com/fingon/ietf- 1494 drafts/ in source format (with nice Makefile too). Feel free to send 1495 comments and/or pull requests if and when you have changes to it! 1497 Appendix E. Acknowledgements 1499 Thanks to Ole Troan, Pierre Pfister, Mark Baugher, Mark Townsley, 1500 Juliusz Chroboczek, Jiazi Yi, Mikael Abrahamsson, Brian Carpenter, 1501 Thomas Clausen, DENG Hui and Margaret Cullen for their contributions 1502 to the draft. 1504 Authors' Addresses 1506 Markus Stenberg 1507 Independent 1508 Helsinki 00930 1509 Finland 1511 Email: markus.stenberg@iki.fi 1513 Steven Barth 1514 Independent 1515 Halle 06114 1516 Germany 1518 Email: cyrus@openwrt.org