idnits 2.17.00 (12 Aug 2021) /tmp/idnits38168/draft-ietf-6lo-6lobac-00.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 (July 4, 2014) is 2878 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) Summary: 1 error (**), 0 flaws (~~), 2 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 Consultant 4 Intended status: Standards Track J. Martocci 5 Expires: January 5, 2015 Johnson Controls 6 C. Neilson 7 Delta Controls 8 S. Donaldson 9 Honeywell 10 July 4, 2014 12 Transmission of IPv6 over MS/TP Networks 13 draft-ietf-6lo-6lobac-00 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 January 5, 2015. 40 Copyright Notice 42 Copyright (c) 2014 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 . . . . . . . . . . . . . . . . . . . . . 6 59 3. Addressing Modes . . . . . . . . . . . . . . . . . . . . . . 6 60 4. Maximum Transmission Unit (MTU) . . . . . . . . . . . . . . . 6 61 5. LoBAC Adaptation Layer . . . . . . . . . . . . . . . . . . . 7 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 will support payloads of up to 1501 octets, 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 MTU: Maximum Transmission Unit 124 MSDU: MAC Service Data Unit (MAC client data) 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 - 1512 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 relevent 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 ASHRAE reserves undefined MS/TP Frame Type values 8 through 31 and 34 204 through 127, inclusive. Frame Types 32 through 127 designate COBS- 205 encoded frames and MUST convey Encoded Data and Encoded CRC-32K 206 fields. All master nodes MUST understand Token, Poll For Master, and 207 Reply to Poll For Master control frames. See Section 2 for 208 additional details. 210 The Destination and Source Addresses are each one octet in length. 211 See Section 3 for additional details. 213 For COBS-encoded frames, the Length field specifies the combined 214 length of the [COBS] Encoded Data and Encoded CRC-32K fields in 215 octets, minus two. (This adjustment is required for backward 216 compatibility with legacy MS/TP devices.) See Section 4 and 217 Appendices for additional details. 219 The Header CRC field covers the Frame Type, Destination Address, 220 Source Address, and Length fields. The Header CRC generation and 221 check procedures are specified in BACnet [Clause9]. 223 1.4. Goals and Non-goals 225 The primary goal of this specification is to enable IPv6 directly on 226 wired end devices in building automation and control networks by 227 leveraging existing standards to the greatest extent possible. A 228 secondary goal is to co-exist with legacy MS/TP implementations. 229 Only the minimal changes necessary to support IPv6 over MS/TP are 230 specified in BACnet [Addendum_an] (see Note in Section 1.3). 232 Non-goals include making changes to the MS/TP frame header format, 233 control frames, Master Node state machine, or addressing modes. 234 Also, while the techniques described here may be applicable to other 235 data links, no attempt is made to define a general design pattern. 237 2. MS/TP Mode for IPv6 239 ASHRAE must assign a new MS/TP Frame Type to indicate IPv6 over MS/TP 240 Encapsulation from the range reserved for designating COBS-encoded 241 frames. The Frame Type requested for IPv6 over MS/TP Encapsulation 242 is 34 (0x22). 244 All MS/TP master nodes (including those that support IPv6) must 245 understand Token, Poll For Master, and Reply to Poll For Master 246 control frames and support the Master Node state machine as specified 247 in BACnet [Clause9]. MS/TP master nodes that support IPv6 must also 248 support the Receive Frame state machine as specified in [Clause9] and 249 extended by BACnet [Addendum_an]. 251 3. Addressing Modes 253 MS/TP link-layer (node) addresses are one octet in length. The 254 method of assigning a node address is outside the scope of this 255 document. However, each MS/TP node on the link MUST have a unique 256 address or a mis-configuration condition exists. 258 BACnet [Clause9] specifies that addresses 0 through 127 are valid for 259 master nodes. The method specified in Section 6 for creating the 260 Interface Identifier (IID) ensures that an IID of all zeros can never 261 result. 263 A Destination Address of 255 (0xFF) denotes a link-level broadcast 264 (all nodes). A Source Address of 255 MUST NOT be used. MS/TP does 265 not support multicast, therefore all IPv6 multicast packets MUST be 266 sent as link-level broadcasts and filtered at the IPv6 layer. 268 This specification assumes that a unique IPv6 subnet prefix is 269 assigned to each MS/TP segment. Hosts learn IPv6 prefixes via router 270 advertisements according to [RFC4861]. 272 4. Maximum Transmission Unit (MTU) 274 BACnet [Addendum_an] supports MPDUs up to 2032 octets in length. 275 This specification defines an MPDU length of at least 1281 octets and 276 at most 1501 octets. This is sufficient to convey the minimum MTU 277 required by IPv6 [RFC2460] without the need for link-layer 278 fragmentation and reassembly. 280 However, the relatively low data rates of MS/TP still make a 281 compelling case for header compression. An adaptation layer to 282 indicate compressed or uncompressed IPv6 headers is specified in 283 Section 5 and the compression scheme is specified in Section 10. 285 5. LoBAC Adaptation Layer 287 The encapsulation formats defined in this section (subsequently 288 referred to as the "LoBAC" encapsulation) comprise the MSDU (payload) 289 of an MS/TP frame. The LoBAC payload (i.e., an IPv6 packet) follows 290 an encapsulation header stack. LoBAC is a subset of the LoWPAN 291 encapsulation defined in [RFC4944], therefore the use of "LOWPAN" in 292 literals below is intentional. The primary differences between LoBAC 293 and LoWPAN are: a) omission of the Fragmentation, Mesh, and Broadcast 294 headers, and b) use of LOWPAN_IPHC [RFC6282] in place of LOWPAN_HC1 295 header compression (which is deprecated by [RFC6282]). 297 All LoBAC encapsulated datagrams transmitted over MS/TP are prefixed 298 by an encapsulation header stack. Each header in the stack consists 299 of a header type followed by zero or more header fields. Whereas in 300 an IPv6 header the stack would contain, in the following order, 301 addressing, hop-by-hop options, routing, fragmentation, destination 302 options, and finally payload [RFC2460]; in a LoBAC encapsulation the 303 analogous sequence is (optional) header compression and payload. The 304 header stacks that are valid in a LoBAC network are shown below. 306 A LoBAC encapsulated IPv6 datagram: 308 +---------------+-------------+---------+ 309 | IPv6 Dispatch | IPv6 Header | Payload | 310 +---------------+-------------+---------+ 312 A LoBAC encapsulated LOWPAN_IPHC compressed IPv6 datagram: 314 +---------------+-------------+---------+ 315 | IPHC Dispatch | IPHC Header | Payload | 316 +---------------+-------------+---------+ 318 All protocol datagrams (i.e., IPv6 or compressed IPv6 headers) SHALL 319 be preceded by one of the valid LoBAC encapsulation headers. This 320 permits uniform software treatment of datagrams without regard to 321 their mode of transmission. 323 The definition of LoBAC headers consists of the dispatch value, the 324 definition of the header fields that follow, and their ordering 325 constraints relative to all other headers. Although the header stack 326 structure provides a mechanism to address future demands on the LoBAC 327 (LoWPAN) adaptation layer, it is not intended to provided general 328 purpose extensibility. This format document specifies a small set of 329 header types using the header stack for clarity, compactness, and 330 orthogonality. 332 5.1. Dispatch Value and Header 334 The LoBAC Dispatch value begins with a "0" bit followed by a "1" bit. 335 The Dispatch value and header are shown here: 337 0 1 2 3 338 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 339 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 340 |0|1| Dispatch | Type-specific header 341 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 343 Dispatch 6-bit selector. Identifies the type of header 344 immediately following the Dispatch value. 346 Type-specific header A header determined by the Dispatch value. 348 Figure 2: Dispatch Value and Header 350 The Dispatch value may be treated as an unstructured namespace. Only 351 a few symbols are required to represent current LoBAC functionality. 352 Although some additional savings could be achieved by encoding 353 additional functionality into the dispatch value, these measures 354 would tend to constrain the ability to address future alternatives. 356 Pattern Header Type 357 +------------+-----------------------------------------------------+ 358 | 00 xxxxxx | NALP - Not a LoWPAN (LoBAC) frame | 359 | 01 000000 | ESC - Additional Dispatch octet follows | 360 | 01 000001 | IPv6 - Uncompressed IPv6 Addresses | 361 | ... | reserved - Defined or reserved by [RFC4944] | 362 | 01 1xxxxx | LOWPAN_IPHC - LOWPAN_IPHC compressed IPv6 [RFC6282] | 363 | 1x xxxxxx | reserved - Defined or reserved by [RFC4944] | 364 +------------+-----------------------------------------------------+ 366 Figure 3: Dispatch Value Bit Patterns 368 NALP: Specifies that the following bits are not a part of the LoBAC 369 encapsulation, and any LoBAC node that encounters a Dispatch 370 value of 00xxxxxx shall discard the packet. Non-LoBAC protocols 371 that wish to coexist with LoBAC nodes should include an octet 372 matching this pattern immediately following the MS/TP header. 374 ESC: Specifies that the following header is a single 8-bit field for 375 the Dispatch value. It allows support for Dispatch values larger 376 than 127 (see [RFC6282] section 5). 378 IPv6: Specifies that the following header is an uncompressed IPv6 379 header [RFC2460]. 381 LOWPAN_IPHC: A value of 011xxxxx specifies a LOWPAN_IPHC compression 382 header (see Section 10.) 384 Reserved: A LoBAC node that encounters a Dispatch value in the range 385 01000010 through 01011111 or 1xxxxxxx SHALL discard the packet. 387 6. Stateless Address Autoconfiguration 389 This section defines how to obtain an IPv6 Interface Identifier. The 390 general procedure is described in Appendix A of [RFC4291], "Creating 391 Modified EUI-64 Format Interface Identifiers", as updated by 392 [RFC7136]. 394 The Interface Identifier MAY be based on an [EUI-64] identifier 395 assigned to the device but this is not typical for MS/TP. In this 396 case, the EUI-64 to IID transformation defined in the IPv6 addressing 397 architecture [RFC4291] MUST be used. This will result in a globally 398 unique Interface Identifier. 400 If the device does not have an EUI-64, then the Interface Identifier 401 SHOULD be formed by concatenating its 8-bit MS/TP node address to the 402 seven octets 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00. For example, 403 an MS/TP node address of hexadecimal value 0x4F results in the 404 following Interface Identifier: 406 |0 1|1 3|3 4|4 6| 407 |0 5|6 1|2 7|8 3| 408 +----------------+----------------+----------------+----------------+ 409 |0000000000000000|0000000011111111|1111111000000000|0000000001001111| 410 +----------------+----------------+----------------+----------------+ 412 This is the RECOMMENDED method of forming an IID, as it supports the 413 most efficient header compression provided by the LOWPAN_IPHC 414 [RFC6282] scheme specified in Section 10. 416 An IPv6 address prefix used for stateless autoconfiguration [RFC4862] 417 of an MS/TP interface MUST have a length of 64 bits. 419 7. IPv6 Link Local Address 421 The IPv6 link-local address [RFC4291] for an MS/TP interface is 422 formed by appending the Interface Identifier, as defined above, to 423 the prefix FE80::/64. 425 10 bits 54 bits 64 bits 426 +----------+-----------------------+----------------------------+ 427 |1111111010| (zeros) | Interface Identifier | 428 +----------+-----------------------+----------------------------+ 430 8. Unicast Address Mapping 432 The address resolution procedure for mapping IPv6 non-multicast 433 addresses into MS/TP link-layer addresses follows the general 434 description in Section 7.2 of [RFC4861], unless otherwise specified. 436 The Source/Target Link-layer Address option has the following form 437 when the addresses are 8-bit MS/TP link-layer (node) addresses. 439 0 1 440 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 441 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 442 | Type | Length=1 | 443 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 444 | | 445 +- Padding (all zeros) -+ 446 | | 447 +- +-+-+-+-+-+-+-+-+ 448 | | MS/TP Address | 449 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 451 Option fields: 453 Type: 455 1: for Source Link-layer address. 457 2: for Target Link-layer address. 459 Length: This is the length of this option (including the type and 460 length fields) in units of 8 octets. The value of this field is 1 461 for 8-bit MS/TP node addresses. 463 MS/TP Address: The 8-bit address in canonical bit order [RFC2469]. 464 This is the unicast address the interface currently responds to. 466 9. Multicast Address Mapping 468 All IPv6 multicast packets MUST be sent to MS/TP Destination Address 469 255 (broadcast) and filtered at the IPv6 layer. When represented as 470 a 16-bit address in a compressed header (see Section 10), it MUST be 471 formed by padding on the left with a zero: 473 0 1 474 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 475 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 476 | 0x00 | 0xFF | 477 +-+-+-+-+-+-+-+-+---------------+ 479 10. Header Compression 481 LoBAC uses LOWPAN_IPHC IPv6 compression, which is specified in 482 [RFC6282] and included herein by reference. This section will simply 483 identify substitutions that should be made when interpreting the text 484 of [RFC6282]. 486 In general the following substitutions should be made: 488 - Replace instances of "6LoWPAN" with "MS/TP network" 490 - Replace instances of "IEEE 802.15.4 address" with "MS/TP address" 492 When a 16-bit address is called for (i.e., an IEEE 802.15.4 "short 493 address") it MUST be formed by padding the MS/TP address to the left 494 with a zero: 496 0 1 497 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 498 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 499 | 0x00 | MS/TP address | 500 +-+-+-+-+-+-+-+-+---------------+ 502 If LOWPAN_IPHC compression [RFC6282] is used with context, the border 503 router(s) directly attached to the MS/TP segment MUST disseminate the 504 6LoWPAN Context Option (6CO) as specified in [RFC6775]. 506 11. IANA Considerations 508 This document uses values previously reserved by [RFC4944] and 509 [RFC6282] and makes no further requests of IANA. 511 Note to RFC Editor: this section may be removed upon publication. 513 12. Security Considerations 515 The method of deriving Interface Identifiers from MAC addresses is 516 intended to preserve global uniqueness when possible. However, there 517 is no protection from duplication through accident or forgery. 519 13. Acknowledgments 521 We are grateful to the authors of [RFC4944] and members of the IETF 522 6LoWPAN working group; this document borrows liberally from their 523 work. 525 14. References 527 14.1. Normative References 529 [Addendum_an] 530 ASHRAE, "Proposed Addendum an to ANSI/ASHRAE Standard 531 135-2012, BACnet - A Data Communication Protocol for 532 Building Automation and Control Networks (Second Public 533 Review)", March 2014, . 536 [Clause9] American Society of Heating, Refrigerating, and Air- 537 Conditioning Engineers, "BACnet - A Data Communication 538 Protocol for Building Automation and Control Networks", 539 ANSI/ASHRAE 135-2012 (Clause 9), March 2013. 541 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 542 Requirement Levels", BCP 14, RFC 2119, March 1997. 544 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 545 (IPv6) Specification", RFC 2460, December 1998. 547 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 548 Architecture", RFC 4291, February 2006. 550 [RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, 551 "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, 552 September 2007. 554 [RFC4862] Thomson, S., Narten, T., and T. Jinmei, "IPv6 Stateless 555 Address Autoconfiguration", RFC 4862, September 2007. 557 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 558 "Transmission of IPv6 Packets over IEEE 802.15.4 559 Networks", RFC 4944, September 2007. 561 [RFC6282] Hui, J. and P. Thubert, "Compression Format for IPv6 562 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 563 September 2011. 565 [RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, 566 "Neighbor Discovery Optimization for IPv6 over Low-Power 567 Wireless Personal Area Networks (6LoWPANs)", RFC 6775, 568 November 2012. 570 [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 571 Interface Identifiers", RFC 7136, February 2014. 573 14.2. Informative References 575 [COBS] Cheshire, S. and M. Baker, "Consistent Overhead Byte 576 Stuffing", IEEE/ACM TRANSACTIONS ON NETWORKING, VOL.7, 577 NO.2 , April 1999, 578 . 580 [CRC32K] Koopman, P., "32-Bit Cyclic Redundancy Codes for Internet 581 Applications", IEEE/IFIP International Conference on 582 Dependable Systems and Networks (DSN 2002) , June 2002, 583 . 586 [EUI-64] IEEE, "Guidelines for 64-bit Global Identifier (EUI-64) 587 Registration Authority", March 1997, 588 . 591 [IEEE.802.3] 592 "Information technology - Telecommunications and 593 information exchange between systems - Local and 594 metropolitan area networks - Specific requirements - Part 595 3: Carrier Sense Multiple Access with Collision Detection 596 (CMSA/CD) Access Method and Physical Layer 597 Specifications", IEEE Std 802.3-2008, December 2008, 598 . 600 [RFC2469] Narten, T. and C. Burton, "A Caution On The Canonical 601 Ordering Of Link-Layer Addresses", RFC 2469, December 602 1998. 604 [TIA-485-A] 605 Telecommunications Industry Association, "TIA-485-A, 606 Electrical Characteristics of Generators and Receivers for 607 Use in Balanced Digital Multipoint Systems (ANSI/TIA/EIA- 608 485-A-98) (R2003)", March 2003. 610 Appendix A. Abstract MAC Interface 612 This Appendix is informative and not part of the standard. 614 BACnet [Clause9] defines support for MAC-layer clients through its 615 SendFrame and ReceivedDataNoReply procedures. However, it does not 616 define a protocol independent abstract interface for the data link. 617 This is provided below as an aid to implementation. 619 A.1. MA-DATA.request 621 A.1.1. Function 623 This primitive defines the transfer of data from a MAC client entity 624 to a single peer entity or multiple peer entities in the case of a 625 broadcast address. 627 A.1.2. Semantics of the Service Primitive 629 The semantics of the primitive are as follows: 631 MA-DATA.request ( 632 destination_address, 633 source_address, 634 data, 635 priority, 636 type 637 ) 639 The 'destination_address' parameter may specify either an individual 640 or a broadcast MAC entity address. It must contain sufficient 641 information to create the Destination Address field (see Section 10) 642 that is prepended to the frame by the local MAC sublayer entity. The 643 'source_address' parameter, if present, must specify an individual 644 MAC address. If the source_address parameter is omitted, the local 645 MAC sublayer entity will insert a value associated with that entity. 647 The 'data' parameter specifies the MAC service data unit (MSDU) to be 648 transferred by the MAC sublayer entity. There is sufficient 649 information associated with the MSDU for the MAC sublayer entity to 650 determine the length of the data unit. 652 The 'priority' parameter specifies the priority desired for the data 653 unit transfer. The priority parameter is ignored by MS/TP. 655 The 'type' parameter specifies the value of the MS/TP Frame Type 656 field that is prepended to the frame by the local MAC sublayer 657 entity. 659 A.1.3. When Generated 661 This primitive is generated by the MAC client entity whenever data 662 shall be transferred to a peer entity or entities. This can be in 663 response to a request from higher protocol layers or from data 664 generated internally to the MAC client, such as a Token frame. 666 A.1.4. Effect on Receipt 668 Receipt of this primitive will cause the MAC entity to insert all MAC 669 specific fields, including Destination Address, Source Address, Frame 670 Type, and any fields that are unique to the particular media access 671 method, and pass the properly formed frame to the lower protocol 672 layers for transfer to the peer MAC sublayer entity or entities. 674 A.2. MA-DATA.indication 676 A.2.1. Function 678 This primitive defines the transfer of data from the MAC sublayer 679 entity to the MAC client entity or entities in the case of a 680 broadcast address. 682 A.2.2. Semantics of the Service Primitive 684 The semantics of the primitive are as follows: 686 MA-DATA.indication ( 687 destination_address, 688 source_address, 689 data, 690 priority, 691 type 692 ) 694 The 'destination_address' parameter may be either an individual or a 695 broadcast address as specified by the Destination Address field of 696 the incoming frame. The 'source_address' parameter is an individual 697 address as specified by the Source Address field of the incoming 698 frame. 700 The 'data' parameter specifies the MAC service data unit (MSDU) as 701 received by the local MAC entity. There is sufficient information 702 associated with the MSDU for the MAC sublayer client to determine the 703 length of the data unit. 705 The 'priority' parameter specifies the priority desired for the data 706 unit transfer. The priority parameter is ignored by MS/TP. 708 The 'type' parameter is the value of the MS/TP Frame Type field of 709 the incoming frame. 711 A.2.3. When Generated 713 The MA_DATA.indication is passed from the MAC sublayer entity to the 714 MAC client entity or entites to indicate the arrival of a frame to 715 the local MAC sublayer entity that is destined for the MAC client. 716 Such frames are reported only if they are validly formed, received 717 without error, and their destination address designates the local MAC 718 entity. Frames destined for the MAC Control sublayer are not passed 719 to the MAC client. 721 A.2.4. Effect on Receipt 723 The effect of receipt of this primitive by the MAC client is 724 unspecified. 726 Appendix B. Consistent Overhead Byte Stuffing [COBS] 728 This Appendix is informative and not part of the standard. 730 BACnet [Addendum_an] corrects a long-standing issue with the MS/TP 731 specification; namely that preamble sequences were not escaped 732 whenever they appeared in the Data or Data CRC fields. In rare 733 cases, this resulted in dropped frames due to loss of frame 734 synchronization. The solution is to encode the Data and 32-bit Data 735 CRC fields before transmission using Consistent Overhead Byte 736 Stuffing [COBS] and decode these fields upon reception. 738 COBS is a run-length encoding method that nominally removes '0x00' 739 octets from its input. Any selected octet value may be removed by 740 XOR'ing that value with each octet of the COBS output. BACnet 741 [Addendum_an] specifies the preamble octet '0x55' for removal. 743 The minimum overhead of COBS is one ectet per encoded field. The 744 worst-case overhead is bounded to one octet in 254, or less than 745 0.5%, as described in [COBS]. 747 Frame encoding proceeds logically in two passes. The Extended Data 748 field is prepared by passing the MSDU through the COBS encoder and 749 XOR'ing the preamble octet '0x055' with each octet of the output. 750 The Extended Data CRC field is then prepared by calculating a CRC-32K 751 over the Extended Data field and formatting it for transmission as 752 described in Appendix C. The combined length of these fields, minus 753 two octets for compatibility with existing MS/TP devices, is placed 754 in the MS/TP header Length field before transmission. 756 Example COBS encoder and decoder functions are shown below for 757 illustration. Complete examples of use and test vectors are provided 758 in BACnet [Addendum_an]. 760 #include 761 #include 763 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 764 #define MSTP_PREAMBLE_X55 (0x55) 766 /* 767 * Encodes 'length' octets of data located at 'from' and 768 * writes one or more COBS code blocks at 'to', removing any 769 * 'mask' octets that may present be in the encoded data. 770 * Returns the length of the encoded data. 771 */ 773 size_t 774 cobs_encode (uint8_t *to, const uint8_t *from, size_t length, 775 uint8_t mask) 776 { 777 size_t code_index = 0; 778 size_t read_index = 0; 779 size_t write_index = 1; 780 uint8_t code = 1; 781 uint8_t data, last_code; 783 while (read_index < length) { 784 data = from[read_index++]; 785 /* 786 * In the case of encountering a non-zero octet in the data, 787 * simply copy input to output and increment the code octet. 788 */ 789 if (data != 0) { 790 to[write_index++] = data ^ mask; 791 code++; 792 if (code != 255) 793 continue; 794 } 795 /* 796 * In the case of encountering a zero in the data or having 797 * copied the maximum number (254) of non-zero octets, store 798 * the code octet and reset the encoder state variables. 799 */ 800 last_code = code; 801 to[code_index] = code ^ mask; 802 code_index = write_index++; 803 code = 1; 805 } 806 /* 807 * If the last chunk contains exactly 254 non-zero octets, then 808 * this exception is handled above (and returned length must be 809 * adjusted). Otherwise, encode the last chunk normally, as if 810 * a "phantom zero" is appended to the data. 811 */ 812 if ((last_code == 255) && (code == 1)) 813 write_index--; 814 else 815 to[code_index] = code ^ mask; 817 return write_index; 818 } 819 #include 820 #include 822 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 823 #define CRC32K_RESIDUE (0x0843323B) 824 #define MSTP_PREAMBLE_X55 (0x55) 826 /* 827 * Decodes 'length' octets of data located at 'from' and 828 * writes the original client data at 'to', restoring any 829 * 'mask' octets that may present in the encoded data. 830 * Returns the length of the encoded data or zero if error. 831 */ 832 size_t 833 cobs_decode (uint8_t *to, const uint8_t *from, size_t length, 834 uint8_t mask) 835 { 836 size_t read_index = 0; 837 size_t write_index = 0; 838 uint8_t code, last_code; 840 while (read_index < length) { 841 code = from[read_index] ^ mask; 842 last_code = code; 843 /* 844 * Sanity check the encoding to prevent the while() loop below 845 * from overrunning the output buffer. 846 */ 847 if (read_index + code > length) 848 return 0; 850 read_index++; 851 while (--code > 0) 852 to[write_index++] = from[read_index++] ^ mask; 853 /* 854 * Restore the implicit zero at the end of each decoded block 855 * except when it contains exactly 254 non-zero octets or the 856 * end of data has been reached. 857 */ 858 if ((last_code != 255) && (read_index < length)) 859 to[write_index++] = 0; 860 } 861 return write_index; 862 } 864 Appendix C. Encoded CRC-32K [CRC32K] 866 This Appendix is informative and not part of the standard. 868 Extending the payload of MS/TP to 1501 octets required upgrading the 869 Data CRC from 16 bits to 32 bits. P.Koopman has authored several 870 papers on evaluating CRC polynomials for network applications. In 871 [CRC32K], he surveyed the entire 32-bit polynomial space and noted 872 some that exceed the [IEEE.802.3] polynomial in performance. BACnet 873 [Addendum_an] specifies the CRC-32K (Koopman) polynomial. 875 The specified use of the calc_crc32K() function is as follows. 876 Before a frame is transmitted, 'crc_value' is initialized to all ones 877 before the function is called. After passing all octets of the 878 [COBS] Encoded Data through the function, the ones complement of the 879 resulting 'crc_value' is arranged in LSB-first order and is itself 880 [COBS] encoded. 882 Upon reception of a frame, 'crc_value' is initialized to all ones. 883 The octets of the Encoded Data field are accumulated by the 884 calc_crc32K() function before decoding. The Encoded CRC-32K field is 885 then decoded and the resulting four octets are accumulated by the 886 calc_crc32K() function. If the result is the expected residue value 887 'CRC32K_RESIDUE', then the frame was received correctly. 889 An example CRC-32K function in shown below for illustration. 890 Complete examples of use and test vectors are provided in BACnet 891 [Addendum_an]. 893 #include 895 /* See BACnet Addendum 135-2012an, section G.3.2 */ 896 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 897 #define CRC32K_RESIDUE (0x0843323B) 899 /* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */ 900 #define CRC32K_POLY (0xEB31D82E) 902 /* 903 * Accumulate 'data_value' into the CRC in 'crc_value'. 904 * Return updated CRC. 905 * 906 * Note: crcValue must be set to CRC32K_INITIAL_VALUE 907 * before initial call. 908 */ 909 uint32_t 910 calc_crc32K (uint8_t data_value, uint32_t crc_value) 911 { 912 uint8_t data, b; 913 uint32_t crc; 915 data = data_value; 916 crc = crc_value; 918 for (b = 0; b < 8; b++) { 919 if ((data & 1) ^ (crc & 1)) { 920 crc >>= 1; 921 crc ^= CRC32K_POLY; 922 } else { 923 crc >>= 1; 924 } 925 data >>= 1; 926 } 927 return crc; 928 } 930 Authors' Addresses 932 Kerry Lynn (editor) 933 Consultant 935 Phone: +1 978 460 4253 936 Email: kerlyn@ieee.org 938 Jerry Martocci 939 Johnson Controls, Inc. 940 507 E. Michigan St 941 Milwaukee , WI 53202 942 USA 944 Phone: +1 414 524 4010 945 Email: jerald.p.martocci@jci.com 947 Carl Neilson 948 Delta Controls, Inc. 949 17850 56th Ave 950 Surrey , BC V3S 1C7 951 Canada 953 Phone: +1 604 575 5913 954 Email: cneilson@deltacontrols.com 956 Stuart Donaldson 957 Honeywell Automation & Control Solutions 958 6670 185th Ave NE 959 Redmond , WA 98052 960 USA 962 Email: stuart.donaldson@honeywell.com