idnits 2.17.00 (12 Aug 2021) /tmp/idnits39718/draft-ietf-6lo-6lobac-01.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 186 has weird spacing: '...Address one ...' -- The document date (March 9, 2015) is 2630 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'Clause9' ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) == Outdated reference: draft-ietf-6man-default-iids has been published as RFC 8064 Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 6Lo Working Group K. Lynn, Ed. 3 Internet-Draft Verizon 4 Intended status: Standards Track J. Martocci 5 Expires: September 10, 2015 Johnson Controls 6 C. Neilson 7 Delta Controls 8 S. Donaldson 9 Honeywell 10 March 9, 2015 12 Transmission of IPv6 over MS/TP Networks 13 draft-ietf-6lo-6lobac-01 15 Abstract 17 Master-Slave/Token-Passing (MS/TP) is a contention-free access method 18 for the RS-485 physical layer, which is used extensively in building 19 automation networks. This specification defines the frame format for 20 transmission of IPv6 packets and the method of forming link-local and 21 statelessly autoconfigured IPv6 addresses on MS/TP networks. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at http://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on September 10, 2015. 40 Copyright Notice 42 Copyright (c) 2015 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (http://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 58 2. MS/TP Mode for IPv6 . . . . . . . . . . . . . . . . . . . . . 5 59 3. Addressing Modes . . . . . . . . . . . . . . . . . . . . . . 6 60 4. Maximum Transmission Unit (MTU) . . . . . . . . . . . . . . . 6 61 5. LoBAC Adaptation Layer . . . . . . . . . . . . . . . . . . . 6 62 6. Stateless Address Autoconfiguration . . . . . . . . . . . . . 9 63 7. IPv6 Link Local Address . . . . . . . . . . . . . . . . . . . 10 64 8. Unicast Address Mapping . . . . . . . . . . . . . . . . . . . 10 65 9. Multicast Address Mapping . . . . . . . . . . . . . . . . . . 11 66 10. Header Compression . . . . . . . . . . . . . . . . . . . . . 11 67 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 68 12. Security Considerations . . . . . . . . . . . . . . . . . . . 12 69 13. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12 70 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 71 Appendix A. Abstract MAC Interface . . . . . . . . . . . . . . . 14 72 Appendix B. Consistent Overhead Byte Stuffing [COBS] . . . . . . 16 73 Appendix C. Encoded CRC-32K [CRC32K] . . . . . . . . . . . . . . 20 74 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 76 1. Introduction 78 Master-Slave/Token-Passing (MS/TP) is a contention-free access method 79 for the RS-485 [TIA-485-A] physical layer, which is used extensively 80 in building automation networks. This specification defines the 81 frame format for transmission of IPv6 [RFC2460] packets and the 82 method of forming link-local and statelessly autoconfigured IPv6 83 addresses on MS/TP networks. The general approach is to adapt 84 elements of the 6LoWPAN [RFC4944] specification to constrained wired 85 networks. 87 An MS/TP device is typically based on a low-cost microcontroller with 88 limited processing power and memory. Together with low data rates 89 and a small address space, these constraints are similar to those 90 faced in 6LoWPAN networks and suggest some elements of that solution 91 might be leveraged. MS/TP differs significantly from 6LoWPAN in at 92 least three respects: a) MS/TP devices typically have a continuous 93 source of power, b) all MS/TP devices on a segment can communicate 94 directly so there are no hidden node or mesh routing issues, and c) 95 recent changes to MS/TP provide support for large payloads, 96 eliminating the need for link-layer fragmentation and reassembly. 98 The following sections provide a brief overview of MS/TP, then 99 describe how to form IPv6 addresses and encapsulate IPv6 packets in 100 MS/TP frames. This document also specifies a header compression 101 mechanism, based on [RFC6282], that is RECOMMENDED in order to make 102 IPv6 practical on low speed MS/TP networks. 104 1.1. Requirements Language 106 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 107 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 108 document are to be interpreted as described in [RFC2119]. 110 1.2. Abbreviations Used 112 ASHRAE: American Society of Heating, Refrigerating, and Air- 113 Conditioning Engineers (http://www.ashrae.org) 115 BACnet: An ISO/ANSI/ASHRAE Standard Data Communication Protocol 116 for Building Automation and Control Networks 118 CRC: Cyclic Redundancy Check 120 MAC: Medium Access Control 122 MSDU: MAC Service Data Unit (MAC client data) 124 MTU: Maximum Transmission Unit 126 UART: Universal Asynchronous Transmitter/Receiver 128 1.3. MS/TP Overview 130 This section provides a brief overview of MS/TP, which is specified 131 in ANSI/ASHRAE 135-2012 (BACnet) Clause 9 [Clause9] and included 132 herein by reference. BACnet [Clause9] also covers physical layer 133 deployment options. 135 MS/TP is designed to enable multidrop networks over shielded twisted 136 pair wiring. It can support a data rate of 115,200 baud on segments 137 up to 1000 meters in length, or segments up to 1200 meters in length 138 at lower baud rates. An MS/TP link requires only a UART, an RS-485 139 [TIA-485-A] transceiver with a driver that can be disabled, and a 5ms 140 resolution timer. These features make MS/TP a cost-effective field 141 bus for the most numerous and least expensive devices in a building 142 automation network. 144 The differential signaling used by [TIA-485-A] requires a contention- 145 free MAC. MS/TP uses a token to control access to a multidrop bus. 147 A master node may initiate the transmission of a data frame when it 148 holds the token. After sending at most a configured maximum number 149 of data frames, a master node passes the token to the next master 150 node (as determined by node address). Slave nodes transmit only when 151 polled and SHALL NOT be considered part of this specification. 153 MS/TP COBS-encoded* frames have the following format: 155 0 1 2 3 156 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 157 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 158 | 0x55 | 0xFF | Frame Type* | DA | 159 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 160 | SA | Length (MS octet first) | Header CRC | 161 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 162 . . 163 . Encoded Data* (2 - 1507 octets) . 164 . . 165 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 166 | | Encoded CRC-32K* (5 octets) | 167 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ 168 | | optional 0xFF | 169 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 171 Figure 1: MS/TP COBS-Encoded Frame Format 173 *Note: BACnet Addendum 135-2012an [Addendum_an] defines a range of 174 Frame Type values to designate frames that contain data and data CRC 175 fields encoded using Consistent Overhead Byte Stuffing [COBS] (see 176 Appendix B). The purpose of COBS encoding is to eliminate preamble 177 sequences from the Encoded Data and Encoded CRC-32K fields. The 178 maximum length of an MSDU as defined by this specification is 1501 179 octets (before encoding). The Encoded Data is covered by a 32-bit 180 CRC [CRC32K] (see Appendix C), which is then itself COBS encoded. 182 MS/TP COBS-encoded frame fields have the following descriptions: 184 Preamble two octet preamble: 0x55, 0xFF 185 Frame Type one octet 186 Destination Address one octet address 187 Source Address one octet address 188 Length two octets, most significant octet first 189 Header CRC one octet 190 Encoded Data 2 - 1512 octets (see Appendix B) 191 Encoded CRC-32K five octets (see Appendix C) 192 (pad) (optional) at most one octet of trailer: 0xFF 194 The Frame Type is used to distinguish between different types of MAC 195 frames. The types relevant to this specification (in decimal) are: 197 0 Token 198 1 Poll For Master 199 2 Reply To Poll For Master 200 ... 201 34 IPv6 over MS/TP (LoBAC) Encapsulation 203 Frame Types 8 through 127 are reserved for assignment by ASHRAE. 204 Frame Types 32 through 127 designate COBS-encoded frames and MUST 205 convey Encoded Data and Encoded CRC-32K fields. All master nodes 206 MUST understand Token, Poll For Master, and Reply to Poll For Master 207 control frames. See Section 2 for additional details. 209 The Destination and Source Addresses are each one octet in length. 210 See Section 3 for additional details. 212 For COBS-encoded frames, the Length field specifies the combined 213 length of the [COBS] Encoded Data and Encoded CRC-32K fields in 214 octets, minus two. (This adjustment is required for backward 215 compatibility with legacy MS/TP devices.) See Section 4 and 216 Appendices for additional details. 218 The Header CRC field covers the Frame Type, Destination Address, 219 Source Address, and Length fields. The Header CRC generation and 220 check procedures are specified in BACnet [Clause9]. 222 1.4. Goals and Non-goals 224 The primary goal of this specification is to enable IPv6 directly on 225 wired end devices in building automation and control networks by 226 leveraging existing standards to the greatest extent possible. A 227 secondary goal is to co-exist with legacy MS/TP implementations. 228 Only the minimum changes necessary to support IPv6 over MS/TP are 229 specified in BACnet [Addendum_an] (see Note in Section 1.3). 231 Non-goals include making changes to the MS/TP frame header format, 232 control frames, Master Node state machine, or addressing modes. 233 Also, while the techniques described here may be applicable to other 234 data links, no attempt is made to define a general design pattern. 236 2. MS/TP Mode for IPv6 238 ASHRAE must assign a new MS/TP Frame Type to indicate IPv6 over MS/TP 239 Encapsulation from the range reserved for designating COBS-encoded 240 frames. The Frame Type requested for IPv6 over MS/TP Encapsulation 241 is 34 (0x22). 243 All MS/TP master nodes (including those that support IPv6) must 244 understand Token, Poll For Master, and Reply to Poll For Master 245 control frames and support the Master Node state machine as specified 246 in BACnet [Clause9]. MS/TP master nodes that support IPv6 must also 247 support the Receive Frame state machine as specified in [Clause9] and 248 extended by BACnet [Addendum_an]. 250 3. Addressing Modes 252 MS/TP link-layer (node) addresses are one octet in length. The 253 method of assigning a node address is outside the scope of this 254 document. However, each MS/TP node on the link MUST have a unique 255 address or a mis-configuration condition exists. 257 BACnet [Clause9] specifies that addresses 0 through 127 are valid for 258 master nodes. The method specified in Section 6 for creating the 259 Interface Identifier (IID) ensures that an IID of all zeros can never 260 result. 262 A Destination Address of 255 (0xFF) denotes a link-level broadcast 263 (all nodes). A Source Address of 255 MUST NOT be used. MS/TP does 264 not support multicast, therefore all IPv6 multicast packets MUST be 265 sent as link-level broadcasts and filtered at the IPv6 layer. 267 This specification assumes that a unique IPv6 subnet prefix is 268 assigned to each MS/TP segment. Hosts learn IPv6 prefixes via router 269 advertisements according to [RFC4861]. 271 4. Maximum Transmission Unit (MTU) 273 BACnet [Addendum_an] supports MSDUs up to 2032 octets in length. 274 This specification defines an MSDU length of at least 1281 octets and 275 at most 1501 octets. This is sufficient to convey the minimum MTU 276 required by IPv6 [RFC2460] without the need for link-layer 277 fragmentation and reassembly. 279 The relatively low data rates of MS/TP, however, still make a 280 compelling case for header compression. An adaptation layer to 281 indicate compressed or uncompressed IPv6 headers is specified in 282 Section 5 and the compression scheme is specified in Section 10. 284 5. LoBAC Adaptation Layer 286 The encapsulation formats defined in this section (subsequently 287 referred to as the "LoBAC" encapsulation) comprise the MSDU (payload) 288 of an MS/TP frame. The LoBAC payload (i.e., an IPv6 packet) follows 289 an encapsulation header stack. LoBAC is a subset of the LoWPAN 290 encapsulation defined in [RFC4944], therefore the use of "LOWPAN" in 291 literals below is intentional. The primary differences between LoBAC 292 and LoWPAN are: a) omission of the Fragmentation, Mesh, and Broadcast 293 headers, and b) use of LOWPAN_IPHC [RFC6282] in place of LOWPAN_HC1 294 header compression (which is deprecated by [RFC6282]). 296 All LoBAC encapsulated datagrams transmitted over MS/TP are prefixed 297 by an encapsulation header stack. Each header in the stack consists 298 of a header type followed by zero or more header fields. Whereas in 299 an IPv6 header the stack would contain, in the following order, 300 addressing, hop-by-hop options, routing, fragmentation, destination 301 options, and finally payload [RFC2460]; in a LoBAC encapsulation the 302 analogous sequence is (optional) header compression and payload. The 303 header stacks that are valid in a LoBAC network are shown below. 305 A LoBAC encapsulated IPv6 datagram: 307 +---------------+-------------+---------+ 308 | IPv6 Dispatch | IPv6 Header | Payload | 309 +---------------+-------------+---------+ 311 A LoBAC encapsulated LOWPAN_IPHC compressed IPv6 datagram: 313 +---------------+-------------+---------+ 314 | IPHC Dispatch | IPHC Header | Payload | 315 +---------------+-------------+---------+ 317 All protocol datagrams (i.e., IPv6 or compressed IPv6 headers) SHALL 318 be preceded by one of the valid LoBAC encapsulation headers. This 319 permits uniform software treatment of datagrams without regard to 320 their mode of transmission. 322 The definition of LoBAC headers consists of the dispatch value, the 323 definition of the header fields that follow, and their ordering 324 constraints relative to all other headers. Although the header stack 325 structure provides a mechanism to address future demands on the LoBAC 326 (LoWPAN) adaptation layer, it is not intended to provided general 327 purpose extensibility. This format document specifies a small set of 328 header types using the header stack for clarity, compactness, and 329 orthogonality. 331 5.1. Dispatch Value and Header 333 The LoBAC Dispatch value begins with a "0" bit followed by a "1" bit. 334 The Dispatch value and header are shown here: 336 0 1 2 3 337 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 338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 339 |0|1| Dispatch | Type-specific header 340 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 342 Dispatch 6-bit selector. Identifies the type of header 343 immediately following the Dispatch value. 345 Type-specific header A header determined by the Dispatch value. 347 Figure 2: Dispatch Value and Header 349 The Dispatch value may be treated as an unstructured namespace. Only 350 a few symbols are required to represent current LoBAC functionality. 351 Although some additional savings could be achieved by encoding 352 additional functionality into the dispatch value, these measures 353 would tend to constrain the ability to address future alternatives. 355 Pattern Header Type 356 +------------+-----------------------------------------------------+ 357 | 00 xxxxxx | NALP - Not a LoWPAN (LoBAC) frame | 358 | 01 000000 | ESC - Additional Dispatch octet follows | 359 | 01 000001 | IPv6 - Uncompressed IPv6 Addresses | 360 | ... | reserved - Defined or reserved by [RFC4944] | 361 | 01 1xxxxx | LOWPAN_IPHC - LOWPAN_IPHC compressed IPv6 [RFC6282] | 362 | 1x xxxxxx | reserved - Defined or reserved by [RFC4944] | 363 +------------+-----------------------------------------------------+ 365 Figure 3: Dispatch Value Bit Patterns 367 NALP: Specifies that the following bits are not a part of the LoBAC 368 encapsulation, and any LoBAC node that encounters a Dispatch 369 value of 00xxxxxx shall discard the packet. Non-LoBAC protocols 370 that wish to coexist with LoBAC nodes should include an octet 371 matching this pattern immediately following the MS/TP header. 373 ESC: Specifies that the following header is a single 8-bit field for 374 the Dispatch value. It allows support for Dispatch values larger 375 than 127 (see Section 5 of [RFC6282]). 377 IPv6: Specifies that the following header is an uncompressed IPv6 378 header [RFC2460]. 380 LOWPAN_IPHC: A value of 011xxxxx specifies a LOWPAN_IPHC compression 381 header (see Section 10.) 383 Reserved: A LoBAC node that encounters a Dispatch value in the range 384 01000010 through 01011111 or 1xxxxxxx SHALL discard the packet. 386 6. Stateless Address Autoconfiguration 388 This section defines how to obtain an IPv6 Interface Identifier. The 389 general procedure is described in Appendix A of [RFC4291], "Creating 390 Modified EUI-64 Format Interface Identifiers", as updated by 391 [RFC7136]. 393 The Interface Identifier MAY be based on an [EUI-64] identifier 394 assigned to the device but this is not typical for MS/TP. In this 395 case, the EUI-64 to IID transformation defined in the IPv6 addressing 396 architecture [RFC4291] MUST be used. This will result in a globally 397 unique Interface Identifier. 399 If the device does not have an EUI-64, then the Interface Identifier 400 SHOULD be formed by concatenating its 8-bit MS/TP node address to the 401 seven octets 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00. For example, 402 an MS/TP node address of hexadecimal value 0x4F results in the 403 following Interface Identifier: 405 |0 1|1 3|3 4|4 6| 406 |0 5|6 1|2 7|8 3| 407 +----------------+----------------+----------------+----------------+ 408 |0000000000000000|0000000011111111|1111111000000000|0000000001001111| 409 +----------------+----------------+----------------+----------------+ 411 This is the RECOMMENDED method of forming an IID, as it supports the 412 most efficient header compression provided by the LOWPAN_IPHC 413 [RFC6282] scheme specified in Section 10. 415 Optionally, an opaque 64-bit IID (for non-link-local addresses) MAY 416 be formed by the technique discussed in [I-D.ietf-6man-default-iids] 417 or alternate method. A node that generates a non-link-local address 418 IID MUST register it with its local router(s) by sending a Neighbor 419 Solicitation (NS) message with the Address Registration Option (ARO) 420 and process Neighbor Advertisements (NA) according to [RFC6775]. 422 An IPv6 address prefix used for stateless autoconfiguration [RFC4862] 423 of an MS/TP interface MUST have a length of 64 bits. 425 7. IPv6 Link Local Address 427 The IPv6 link-local address [RFC4291] for an MS/TP interface is 428 formed by appending the Interface Identifier, as defined above, to 429 the prefix FE80::/64. 431 10 bits 54 bits 64 bits 432 +----------+-----------------------+----------------------------+ 433 |1111111010| (zeros) | Interface Identifier | 434 +----------+-----------------------+----------------------------+ 436 8. Unicast Address Mapping 438 The address resolution procedure for mapping IPv6 non-multicast 439 addresses into MS/TP link-layer addresses follows the general 440 description in Section 7.2 of [RFC4861], unless otherwise specified. 442 The Source/Target Link-layer Address option has the following form 443 when the addresses are 8-bit MS/TP link-layer (node) addresses. 445 0 1 446 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 447 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 448 | Type | Length=1 | 449 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 450 | | 451 + Padding (all zeros) + 452 | | 453 + +-+-+-+-+-+-+-+-+ 454 | | MS/TP Address | 455 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 457 Option fields: 459 Type: 461 1: for Source Link-layer address. 463 2: for Target Link-layer address. 465 Length: This is the length of this option (including the type and 466 length fields) in units of 8 octets. The value of this field is 1 467 for 8-bit MS/TP node addresses. 469 MS/TP Address: The 8-bit address in canonical bit order [RFC2469]. 470 This is the unicast address the interface currently responds to. 472 9. Multicast Address Mapping 474 All IPv6 multicast packets MUST be sent to MS/TP Destination Address 475 255 (broadcast) and filtered at the IPv6 layer. When represented as 476 a 16-bit address in a compressed header (see Section 10), it MUST be 477 formed by padding on the left with a zero: 479 0 1 480 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 482 | 0x00 | 0xFF | 483 +-+-+-+-+-+-+-+-+---------------+ 485 10. Header Compression 487 LoBAC uses LOWPAN_IPHC IPv6 compression, which is specified in 488 [RFC6282] and included herein by reference. This section will simply 489 identify substitutions that should be made when interpreting the text 490 of [RFC6282]. 492 In general the following substitutions should be made: 494 - Replace instances of "6LoWPAN" with "MS/TP network" 496 - Replace instances of "IEEE 802.15.4 address" with "MS/TP address" 498 When a 16-bit address is called for (i.e., an IEEE 802.15.4 "short 499 address") it MUST be formed by padding the MS/TP address to the left 500 with a zero: 502 0 1 503 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 504 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 505 | 0x00 | MS/TP address | 506 +-+-+-+-+-+-+-+-+---------------+ 508 If LOWPAN_IPHC compression [RFC6282] is used with context, the border 509 router(s) directly attached to the MS/TP segment MUST disseminate the 510 6LoWPAN Context Option (6CO) as specified in [RFC6775]. 512 11. IANA Considerations 514 This document uses values previously reserved by [RFC4944] and 515 [RFC6282] and makes no further requests of IANA. 517 Note to RFC Editor: this section may be removed upon publication. 519 12. Security Considerations 521 The method of deriving Interface Identifiers from MAC addresses is 522 intended to preserve global uniqueness when possible. However, there 523 is no protection from duplication through accident or forgery. 525 13. Acknowledgments 527 We are grateful to the authors of [RFC4944] and members of the IETF 528 6LoWPAN working group; this document borrows liberally from their 529 work. 531 14. References 533 14.1. Normative References 535 [Addendum_an] 536 ASHRAE, "ANSI/ASHRAE Addenda an, at, au, av, aw, ax, and 537 az to ANSI/ASHRAE Standard 135-2012, BACnet - A Data 538 Communication Protocol for Building Automation and Control 539 Networks", July 2014, 540 . 543 [Clause9] American Society of Heating, Refrigerating, and Air- 544 Conditioning Engineers, "BACnet - A Data Communication 545 Protocol for Building Automation and Control Networks", 546 ANSI/ASHRAE 135-2012 (Clause 9), March 2013. 548 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 549 Requirement Levels", BCP 14, RFC 2119, March 1997. 551 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 552 (IPv6) Specification", RFC 2460, December 1998. 554 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 555 Architecture", RFC 4291, February 2006. 557 [RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, 558 "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, 559 September 2007. 561 [RFC4862] Thomson, S., Narten, T., and T. Jinmei, "IPv6 Stateless 562 Address Autoconfiguration", RFC 4862, September 2007. 564 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 565 "Transmission of IPv6 Packets over IEEE 802.15.4 566 Networks", RFC 4944, September 2007. 568 [RFC6282] Hui, J. and P. Thubert, "Compression Format for IPv6 569 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 570 September 2011. 572 [RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, 573 "Neighbor Discovery Optimization for IPv6 over Low-Power 574 Wireless Personal Area Networks (6LoWPANs)", RFC 6775, 575 November 2012. 577 [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 578 Interface Identifiers", RFC 7136, February 2014. 580 14.2. Informative References 582 [COBS] Cheshire, S. and M. Baker, "Consistent Overhead Byte 583 Stuffing", IEEE/ACM TRANSACTIONS ON NETWORKING, VOL.7, 584 NO.2 , April 1999, 585 . 587 [CRC32K] Koopman, P., "32-Bit Cyclic Redundancy Codes for Internet 588 Applications", IEEE/IFIP International Conference on 589 Dependable Systems and Networks (DSN 2002) , June 2002, 590 . 593 [EUI-64] IEEE, "Guidelines for 64-bit Global Identifier (EUI-64) 594 Registration Authority", March 1997, 595 . 598 [I-D.ietf-6man-default-iids] 599 Gont, F., Cooper, A., Thaler, D., and W. Will, 600 "Recommendation on Stable IPv6 Interface Identifiers", 601 draft-ietf-6man-default-iids-02 (work in progress), 602 January 2015. 604 [IEEE.802.3] 605 "Information technology - Telecommunications and 606 information exchange between systems - Local and 607 metropolitan area networks - Specific requirements - Part 608 3: Carrier Sense Multiple Access with Collision Detection 609 (CMSA/CD) Access Method and Physical Layer 610 Specifications", IEEE Std 802.3-2008, December 2008, 611 . 613 [RFC2469] Narten, T. and C. Burton, "A Caution On The Canonical 614 Ordering Of Link-Layer Addresses", RFC 2469, December 615 1998. 617 [TIA-485-A] 618 Telecommunications Industry Association, "TIA-485-A, 619 Electrical Characteristics of Generators and Receivers for 620 Use in Balanced Digital Multipoint Systems (ANSI/TIA/EIA- 621 485-A-98) (R2003)", March 2003. 623 Appendix A. Abstract MAC Interface 625 This Appendix is informative and not part of the standard. 627 BACnet [Clause9] defines support for MAC-layer clients through its 628 SendFrame and ReceivedDataNoReply procedures. However, it does not 629 define a protocol independent abstract interface for the data link. 630 This is provided below as an aid to implementation. 632 A.1. MA-DATA.request 634 A.1.1. Function 636 This primitive defines the transfer of data from a MAC client entity 637 to a single peer entity or multiple peer entities in the case of a 638 broadcast address. 640 A.1.2. Semantics of the Service Primitive 642 The semantics of the primitive are as follows: 644 MA-DATA.request ( 645 destination_address, 646 source_address, 647 data, 648 priority, 649 type 650 ) 652 The 'destination_address' parameter may specify either an individual 653 or a broadcast MAC entity address. It must contain sufficient 654 information to create the Destination Address field (see Section 1.3) 655 that is prepended to the frame by the local MAC sublayer entity. The 656 'source_address' parameter, if present, must specify an individual 657 MAC address. If the source_address parameter is omitted, the local 658 MAC sublayer entity will insert a value associated with that entity. 660 The 'data' parameter specifies the MAC service data unit (MSDU) to be 661 transferred by the MAC sublayer entity. There is sufficient 662 information associated with the MSDU for the MAC sublayer entity to 663 determine the length of the data unit. 665 The 'priority' parameter specifies the priority desired for the data 666 unit transfer. The priority parameter is ignored by MS/TP. 668 The 'type' parameter specifies the value of the MS/TP Frame Type 669 field that is prepended to the frame by the local MAC sublayer 670 entity. 672 A.1.3. When Generated 674 This primitive is generated by the MAC client entity whenever data 675 shall be transferred to a peer entity or entities. This can be in 676 response to a request from higher protocol layers or from data 677 generated internally to the MAC client, such as a Token frame. 679 A.1.4. Effect on Receipt 681 Receipt of this primitive will cause the MAC entity to insert all MAC 682 specific fields, including Destination Address, Source Address, Frame 683 Type, and any fields that are unique to the particular media access 684 method, and pass the properly formed frame to the lower protocol 685 layers for transfer to the peer MAC sublayer entity or entities. 687 A.2. MA-DATA.indication 689 A.2.1. Function 691 This primitive defines the transfer of data from the MAC sublayer 692 entity to the MAC client entity or entities in the case of a 693 broadcast address. 695 A.2.2. Semantics of the Service Primitive 697 The semantics of the primitive are as follows: 699 MA-DATA.indication ( 700 destination_address, 701 source_address, 702 data, 703 priority, 704 type 705 ) 707 The 'destination_address' parameter may be either an individual or a 708 broadcast address as specified by the Destination Address field of 709 the incoming frame. The 'source_address' parameter is an individual 710 address as specified by the Source Address field of the incoming 711 frame. 713 The 'data' parameter specifies the MAC service data unit (MSDU) as 714 received by the local MAC entity. There is sufficient information 715 associated with the MSDU for the MAC sublayer client to determine the 716 length of the data unit. 718 The 'priority' parameter specifies the priority desired for the data 719 unit transfer. The priority parameter is ignored by MS/TP. 721 The 'type' parameter is the value of the MS/TP Frame Type field of 722 the incoming frame. 724 A.2.3. When Generated 726 The MA_DATA.indication is passed from the MAC sublayer entity to the 727 MAC client entity or entities to indicate the arrival of a frame to 728 the local MAC sublayer entity that is destined for the MAC client. 729 Such frames are reported only if they are validly formed, received 730 without error, and their destination address designates the local MAC 731 entity. Frames destined for the MAC Control sublayer are not passed 732 to the MAC client. 734 A.2.4. Effect on Receipt 736 The effect of receipt of this primitive by the MAC client is 737 unspecified. 739 Appendix B. Consistent Overhead Byte Stuffing [COBS] 741 This Appendix is informative and not part of the standard. 743 BACnet [Addendum_an] corrects a long-standing issue with the MS/TP 744 specification; namely that preamble sequences were not escaped 745 whenever they appeared in the Data or Data CRC fields. In rare 746 cases, this resulted in dropped frames due to loss of frame 747 synchronization. The solution is to encode the Data and 32-bit Data 748 CRC fields before transmission using Consistent Overhead Byte 749 Stuffing [COBS] and decode these fields upon reception. 751 COBS is a run-length encoding method that nominally removes '0x00' 752 octets from its input. Any selected octet value may be removed by 753 XOR'ing that value with each octet of the COBS output. BACnet 754 [Addendum_an] specifies the preamble octet '0x55' for removal. 756 The minimum overhead of COBS is one ectet per encoded field. The 757 worst-case overhead is bounded to one octet in 254, or less than 758 0.5%, as described in [COBS]. 760 Frame encoding proceeds logically in two passes. The Encoded Data 761 field is prepared by passing the MSDU through the COBS encoder and 762 XOR'ing the preamble octet '0x055' with each octet of the output. 763 The Encoded CRC-32K field is then prepared by calculating a CRC-32K 764 over the Encoded Data field and formatting it for transmission as 765 described in Appendix C. The combined length of these fields, minus 766 two octets for compatibility with existing MS/TP devices, is placed 767 in the MS/TP header Length field before transmission. 769 Example COBS encoder and decoder functions are shown below for 770 illustration. Complete examples of use and test vectors are provided 771 in BACnet [Addendum_an]. 773 #include 774 #include 776 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 777 #define MSTP_PREAMBLE_X55 (0x55) 779 /* 780 * Encodes 'length' octets of data located at 'from' and 781 * writes one or more COBS code blocks at 'to', removing any 782 * 'mask' octets that may present be in the encoded data. 783 * Returns the length of the encoded data. 784 */ 786 size_t 787 cobs_encode (uint8_t *to, const uint8_t *from, size_t length, 788 uint8_t mask) 789 { 790 size_t code_index = 0; 791 size_t read_index = 0; 792 size_t write_index = 1; 793 uint8_t code = 1; 794 uint8_t data, last_code; 796 while (read_index < length) { 797 data = from[read_index++]; 798 /* 799 * In the case of encountering a non-zero octet in the data, 800 * simply copy input to output and increment the code octet. 801 */ 802 if (data != 0) { 803 to[write_index++] = data ^ mask; 804 code++; 805 if (code != 255) 806 continue; 807 } 808 /* 809 * In the case of encountering a zero in the data or having 810 * copied the maximum number (254) of non-zero octets, store 811 * the code octet and reset the encoder state variables. 812 */ 813 last_code = code; 814 to[code_index] = code ^ mask; 815 code_index = write_index++; 816 code = 1; 817 } 818 /* 819 * If the last chunk contains exactly 254 non-zero octets, then 820 * this exception is handled above (and returned length must be 821 * adjusted). Otherwise, encode the last chunk normally, as if 822 * a "phantom zero" is appended to the data. 823 */ 824 if ((last_code == 255) && (code == 1)) 825 write_index--; 826 else 827 to[code_index] = code ^ mask; 829 return write_index; 830 } 831 #include 832 #include 834 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 835 #define MSTP_PREAMBLE_X55 (0x55) 837 /* 838 * Decodes 'length' octets of data located at 'from' and 839 * writes the original client data at 'to', restoring any 840 * 'mask' octets that may present in the encoded data. 841 * Returns the length of the encoded data or zero if error. 842 */ 843 size_t 844 cobs_decode (uint8_t *to, const uint8_t *from, size_t length, 845 uint8_t mask) 846 { 847 size_t read_index = 0; 848 size_t write_index = 0; 849 uint8_t code, last_code; 851 while (read_index < length) { 852 code = from[read_index] ^ mask; 853 last_code = code; 854 /* 855 * Sanity check the encoding to prevent the while() loop below 856 * from overrunning the output buffer. 857 */ 858 if (read_index + code > length) 859 return 0; 861 read_index++; 862 while (--code > 0) 863 to[write_index++] = from[read_index++] ^ mask; 864 /* 865 * Restore the implicit zero at the end of each decoded block 866 * except when it contains exactly 254 non-zero octets or the 867 * end of data has been reached. 868 */ 869 if ((last_code != 255) && (read_index < length)) 870 to[write_index++] = 0; 871 } 872 return write_index; 873 } 875 Appendix C. Encoded CRC-32K [CRC32K] 877 This Appendix is informative and not part of the standard. 879 Extending the payload of MS/TP to 1501 octets required upgrading the 880 Data CRC from 16 bits to 32 bits. P.Koopman has authored several 881 papers on evaluating CRC polynomials for network applications. In 882 [CRC32K], he surveyed the entire 32-bit polynomial space and noted 883 some that exceed the [IEEE.802.3] polynomial in performance. BACnet 884 [Addendum_an] specifies the CRC-32K (Koopman) polynomial. 886 The specified use of the calc_crc32K() function is as follows. 887 Before a frame is transmitted, 'crc_value' is initialized to all 888 ones. After passing each octet of the [COBS] Encoded Data through 889 the function, the ones complement of the resulting 'crc_value' is 890 arranged in LSB-first order and is itself [COBS] encoded. The length 891 of the resulting Encoded CRC-32K field is always five octets. 893 Upon reception of a frame, 'crc_value' is initialized to all ones. 894 The octets of the Encoded Data field are accumulated by the 895 calc_crc32K() function before decoding. The Encoded CRC-32K field is 896 then decoded and the resulting four octets are accumulated by the 897 calc_crc32K() function. If the result is the expected residue value 898 'CRC32K_RESIDUE', then the frame was received correctly. 900 An example CRC-32K function in shown below for illustration. 901 Complete examples of use and test vectors are provided in BACnet 902 [Addendum_an]. 904 #include 906 /* See BACnet Addendum 135-2012an, section G.3.2 */ 907 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 908 #define CRC32K_RESIDUE (0x0843323B) 910 /* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */ 911 #define CRC32K_POLY (0xEB31D82E) 913 /* 914 * Accumulate 'data_value' into the CRC in 'crc_value'. 915 * Return updated CRC. 916 * 917 * Note: crcValue must be set to CRC32K_INITIAL_VALUE 918 * before initial call. 919 */ 920 uint32_t 921 calc_crc32K (uint8_t data_value, uint32_t crc_value) 922 { 923 int b; 925 for (b = 0; b < sizeof(uint8_t); b++) { 926 if ((data_value & 1) ^ (crc_value & 1)) { 927 crc_value >>= 1; 928 crc_value ^= CRC32K_POLY; 929 } else { 930 crc_value >>= 1; 931 } 932 data_value >>= 1; 933 } 934 return crc_value; 935 } 937 Authors' Addresses 939 Kerry Lynn (editor) 940 Verizon 941 50 Sylvan Rd 942 Waltham , MA 02451 943 USA 945 Phone: +1 781 296 9722 946 Email: kerlyn@ieee.org 948 Jerry Martocci 949 Johnson Controls, Inc. 950 507 E. Michigan St 951 Milwaukee , WI 53202 952 USA 954 Phone: +1 414 524 4010 955 Email: jerald.p.martocci@jci.com 957 Carl Neilson 958 Delta Controls, Inc. 959 17850 56th Ave 960 Surrey , BC V3S 1C7 961 Canada 963 Phone: +1 604 575 5913 964 Email: cneilson@deltacontrols.com 966 Stuart Donaldson 967 Honeywell Automation & Control Solutions 968 6670 185th Ave NE 969 Redmond , WA 98052 970 USA 972 Email: stuart.donaldson@honeywell.com