idnits 2.17.00 (12 Aug 2021) /tmp/idnits41102/draft-ietf-6lo-6lobac-02.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 187 has weird spacing: '...Address one ...' -- The document date (July 6, 2015) is 2511 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 == Outdated reference: draft-ietf-6man-ipv6-address-generation-privacy has been published as RFC 7721 Summary: 1 error (**), 0 flaws (~~), 4 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 Labs 4 Intended status: Standards Track J. Martocci 5 Expires: January 7, 2016 Johnson Controls 6 C. Neilson 7 Delta Controls 8 S. Donaldson 9 Honeywell 10 July 6, 2015 12 Transmission of IPv6 over MS/TP Networks 13 draft-ietf-6lo-6lobac-02 15 Abstract 17 Master-Slave/Token-Passing (MS/TP) is a medium access control 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 7, 2016. 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 . . . . . . . . . . . . . 7 63 7. IPv6 Link Local Address . . . . . . . . . . . . . . . . . . . 8 64 8. Unicast Address Mapping . . . . . . . . . . . . . . . . . . . 8 65 9. Multicast Address Mapping . . . . . . . . . . . . . . . . . . 9 66 10. Header Compression . . . . . . . . . . . . . . . . . . . . . 9 67 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 68 12. Security Considerations . . . . . . . . . . . . . . . . . . . 10 69 13. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 10 70 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 71 Appendix A. Abstract MAC Interface . . . . . . . . . . . . . . . 13 72 Appendix B. Consistent Overhead Byte Stuffing [COBS] . . . . . . 15 73 Appendix C. Encoded CRC-32K [CRC32K] . . . . . . . . . . . . . . 19 74 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 76 1. Introduction 78 Master-Slave/Token-Passing (MS/TP) is a medium access control (MAC) 79 protocol for the RS-485 [TIA-485-A] physical layer, which is used 80 extensively in building automation networks. This specification 81 defines the frame format for transmission of IPv6 [RFC2460] packets 82 and the method of forming link-local and statelessly autoconfigured 83 IPv6 addresses on MS/TP networks. The general approach is to adapt 84 elements of the 6LoWPAN specifications [RFC4944], [RFC6282], and 85 [RFC6775] to constrained wired 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 MAC 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 fragmentation and reassembly below IPv6. 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 REQUIRED in order to reduce 102 latency and make IPv6 practical on 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 MAC address). Slave nodes do not support the 151 frame format required to convey IPv6 over MS/TP and therefore SHALL 152 NOT be considered part of this specification. 154 MS/TP COBS-encoded* frames have the following format: 156 0 1 2 3 157 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 158 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 159 | 0x55 | 0xFF | Frame Type* | DA | 160 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 161 | SA | Length (MS octet first) | Header CRC | 162 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 163 . . 164 . Encoded Data* (2 - 1506 octets) . 165 . . 166 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 167 | | Encoded CRC-32K* (5 octets) | 168 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ 169 | | optional 0xFF | 170 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 172 Figure 1: MS/TP COBS-Encoded Frame Format 174 *NOTE: BACnet Addendum 135-2012an [Addendum_an] defines a range of 175 Frame Type values to designate frames that contain data and data CRC 176 fields encoded using Consistent Overhead Byte Stuffing [COBS] (see 177 Appendix B). The purpose of COBS encoding is to eliminate preamble 178 sequences from the Encoded Data and Encoded CRC-32K fields. The 179 maximum length of an MSDU as defined by this specification is 1500 180 octets (before encoding). The Encoded Data is covered by a 32-bit 181 CRC [CRC32K] (see Appendix C), which is itself then COBS encoded. 183 MS/TP COBS-encoded frame fields have the following descriptions: 185 Preamble two octet preamble: 0x55, 0xFF 186 Frame Type one octet 187 Destination Address one octet address 188 Source Address one octet address 189 Length two octets, most significant octet first 190 Header CRC one octet 191 Encoded Data 2 - 1506 octets (see Appendix B) 192 Encoded CRC-32K five octets (see Appendix C) 193 (pad) (optional) at most one octet of trailer: 0xFF 195 The Frame Type is used to distinguish between different types of MAC 196 frames. The types relevant to this specification (in decimal) are: 198 0 Token 199 1 Poll For Master 200 2 Reply To Poll For Master 201 ... 202 34 IPv6 over MS/TP (LoBAC) Encapsulation 204 Frame Types 8 - 31 and 35 - 127 are reserved for assignment by 205 ASHRAE. Frame Types 32 - 127 designate COBS-encoded frames and MUST 206 convey Encoded Data and Encoded CRC-32K fields. All master nodes 207 MUST understand Token, Poll For Master, and Reply to Poll For Master 208 control frames. See Section 2 for 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 Constraints 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 minimum changes necessary to support IPv6 over MS/TP were 230 specified in BACnet [Addendum_an] (see Note in Section 1.3). 232 In order to co-exist with legacy devices, no changes are permitted to 233 the MS/TP addressing modes, frame header format, control frames, or 234 Master Node state machine as specified in BACnet [Clause9]. 236 2. MS/TP Mode for IPv6 238 ASHRAE has assigned an MS/TP Frame Type value of 34 to indicate IPv6 239 over MS/TP (LoBAC) Encapsulation. This falls within the range of 240 values that designate COBS-encoded data frames. 242 All MS/TP master nodes (including those that support IPv6) must 243 understand Token, Poll For Master, and Reply to Poll For Master 244 control frames and support the Master Node state machine as specified 245 in BACnet [Clause9]. MS/TP master nodes that support IPv6 must also 246 support the Receive Frame state machine as specified in [Clause9] and 247 extended by BACnet [Addendum_an]. 249 3. Addressing Modes 251 MS/TP node (MAC) addresses are one octet in length. The method of 252 assigning MAC addresses is outside the scope of this specification. 253 However, each MS/TP node on the link MUST have a unique address in 254 order to ensure correct MAC operation. 256 BACnet [Clause9] specifies that addresses 0 through 127 are valid for 257 master nodes. The method specified in Section 6 for creating a MAC- 258 layer-derived Interface Identifier (IID) ensures that an IID of all 259 zeros can never result. 261 A Destination Address of 255 (all nodes) indicates a MAC-layer 262 broadcast. MS/TP does not support multicast, therefore all IPv6 263 multicast packets SHOULD be broadcast at the MAC layer and filtered 264 at the IPv6 layer. A Source Address of 255 MUST NOT be used. 266 This specification assumes that at most one unique local and/or 267 global IPv6 prefix is assigned to each MS/TP segment. Hosts learn 268 IPv6 prefixes via router advertisements according to [RFC4861]. 270 4. Maximum Transmission Unit (MTU) 272 BACnet [Addendum_an] supports MSDUs up to 2032 octets in length. 273 This specification defines an MSDU length of at least 1280 octets and 274 at most 1500 octets (before encoding). This is sufficient to convey 275 the minimum MTU required by IPv6 [RFC2460] without the need for link- 276 layer fragmentation and reassembly. 278 5. LoBAC Adaptation Layer 280 The relatively low data rates of MS/TP indicate header compression as 281 a means to reduce latency. This section specifies an adaptation 282 layer to support compressed IPv6 headers and the compression format 283 is specified in Section 10. 285 Implementations MAY also support Generic Header Compression (GHC) 286 [RFC7400] for transport layer headers. A node implementing [RFC7400] 287 MUST probe its peers for GHC support before applying GHC. 289 The encapsulation format defined in this section (subsequently 290 referred to as the "LoBAC" encapsulation) comprises the MSDU of an 291 IPv6 over MS/TP frame. The LoBAC payload (i.e., an IPv6 packet) 292 follows an encapsulation header stack. LoBAC is a subset of the 293 LoWPAN encapsulation defined in [RFC4944] and extended by [RFC6282], 294 therefore the use of "LOWPAN" in literals below is intentional. The 295 primary difference between LoWPAN and LoBAC is omission of the Mesh, 296 Broadcast, Fragmentation, and LOWPAN_HC1 headers. 298 All LoBAC encapsulated datagrams transmitted over MS/TP are prefixed 299 by an encapsulation header stack consisting of a Dispatch value 300 followed by zero or more header fields. The only sequence currently 301 defined for LoBAC is the LOWPAN_IPHC header followed by payload, as 302 shown below: 304 +---------------+---------------+------...-----+ 305 | IPHC Dispatch | IPHC Header | Payload | 306 +---------------+---------------+------...-----+ 308 Figure 2: A LoBAC Encapsulated LOWPAN_IPHC Compressed IPv6 Datagram 310 The Dispatch value may be treated as an unstructured namespace. Only 311 a single pattern is used to represent current LoBAC functionality. 313 Pattern Header Type 314 +------------+-----------------------------------------------------+ 315 | 01 1xxxxx | LOWPAN_IPHC - LOWPAN_IPHC compressed IPv6 [RFC6282] | 316 +------------+-----------------------------------------------------+ 318 Figure 3: LoBAC Dispatch Value Bit Pattern 320 Other IANA-assigned 6LoWPAN Dispatch values do not apply to this 321 specification. 323 6. Stateless Address Autoconfiguration 325 This section defines how to obtain an IPv6 Interface Identifier. The 326 general procedure for creating a MAC-address-derived IID is described 327 in [RFC4291] Appendix A, "Creating Modified EUI-64 Format Interface 328 Identifiers", as updated by [RFC7136]. 330 The IID SHOULD NOT embed an [EUI-64] or any other globally unique 331 hardware identifier assigned to a device (see Section 12). 333 The Interface Identifier for link-local addresses SHOULD be formed by 334 concatenating its 8-bit MS/TP MAC address to the seven octets 0x00, 335 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00. For example, an MS/TP MAC 336 address of hexadecimal value 0x4F results in the following IID: 338 |0 1|1 3|3 4|4 6| 339 |0 5|6 1|2 7|8 3| 340 +----------------+----------------+----------------+----------------+ 341 |0000000000000000|0000000011111111|1111111000000000|0000000001001111| 342 +----------------+----------------+----------------+----------------+ 344 This is the RECOMMENDED method of forming an IID for use in link- 345 local addresses, as it affords the most efficient header compression 346 provided by the LOWPAN_IPHC [RFC6282] format specified in Section 10. 348 A 64-bit privacy IID is RECOMMENDED for routable addresses and SHOULD 349 be locally generated according to [I-D.ietf-6man-default-iids]. A 350 node that generates a 64-bit privacy IID MUST register it with its 351 local router(s) by sending a Neighbor Solicitation (NS) message with 352 the Address Registration Option (ARO) and process Neighbor 353 Advertisements (NA) according to [RFC6775]. 355 An IPv6 address prefix used for stateless autoconfiguration [RFC4862] 356 of an MS/TP interface MUST have a length of 64 bits. 358 7. IPv6 Link Local Address 360 The IPv6 link-local address [RFC4291] for an MS/TP interface is 361 formed by appending the Interface Identifier, as defined above, to 362 the prefix FE80::/64. 364 10 bits 54 bits 64 bits 365 +----------+-----------------------+----------------------------+ 366 |1111111010| (zeros) | Interface Identifier | 367 +----------+-----------------------+----------------------------+ 369 8. Unicast Address Mapping 371 The address resolution procedure for mapping IPv6 non-multicast 372 addresses into MS/TP MAC-layer addresses follows the general 373 description in Section 7.2 of [RFC4861], unless otherwise specified. 375 The Source/Target Link-layer Address option has the following form 376 when the addresses are 8-bit MS/TP MAC-layer (node) addresses. 378 0 1 379 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 380 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 381 | Type | Length=1 | 382 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 383 | | 384 + Padding (all zeros) + 385 | | 386 + +-+-+-+-+-+-+-+-+ 387 | | MS/TP Address | 388 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 390 Option fields: 392 Type: 394 1: for Source Link-layer address. 396 2: for Target Link-layer address. 398 Length: This is the length of this option (including the type and 399 length fields) in units of 8 octets. The value of this field is 1 400 for 8-bit MS/TP MAC addresses. 402 MS/TP Address: The 8-bit address in canonical bit order [RFC2469]. 403 This is the unicast address the interface currently responds to. 405 9. Multicast Address Mapping 407 All IPv6 multicast packets SHOULD be sent to MS/TP Destination 408 Address 255 (broadcast) and filtered at the IPv6 layer. When 409 represented as a 16-bit address in a compressed header (see 410 Section 10), it MUST be formed by padding on the left with a zero: 412 0 1 413 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 414 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 415 | 0x00 | 0xFF | 416 +-+-+-+-+-+-+-+-+---------------+ 418 10. Header Compression 420 LoBAC uses LOWPAN_IPHC IPv6 compression, which is specified in 421 [RFC6282] and included herein by reference. This section will simply 422 identify substitutions that should be made when interpreting the text 423 of [RFC6282]. 425 In general the following substitutions should be made: 427 - Replace instances of "6LoWPAN" with "MS/TP network" 429 - Replace instances of "IEEE 802.15.4 address" with "MS/TP address" 431 When a 16-bit address is called for (i.e., an IEEE 802.15.4 "short 432 address") it MUST be formed by padding the MS/TP address to the left 433 with a zero: 435 0 1 436 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 437 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 438 | 0x00 | MS/TP address | 439 +-+-+-+-+-+-+-+-+---------------+ 441 If LOWPAN_IPHC compression [RFC6282] is used with context, the border 442 router(s) directly attached to the MS/TP segment MUST disseminate the 443 6LoWPAN Context Option (6CO) according to [RFC6775], Section 7.2. 445 11. IANA Considerations 447 This document uses values previously reserved by [RFC4944] and 448 [RFC6282] and makes no further requests of IANA. 450 Note to RFC Editor: this section may be removed upon publication. 452 12. Security Considerations 454 The security and privacy implications of embedding a link-layer 455 address in an IPv6 IID are discussed in 456 [I-D.ietf-6man-ipv6-address-generation-privacy]. The issue most 457 relevant to MS/TP networks is address scanning. This is mainly an 458 issue for routable addresses and probably only for those hosted on 459 the global Internet. This specification RECOMMENDS mitigating this 460 threat according to [I-D.ietf-6man-default-iids]. 462 13. Acknowledgments 464 We are grateful to the authors of [RFC4944] and members of the IETF 465 6LoWPAN working group; this document borrows liberally from their 466 work. 468 14. References 470 14.1. Normative References 472 [Addendum_an] 473 ASHRAE, "ANSI/ASHRAE Addenda an, at, au, av, aw, ax, and 474 az to ANSI/ASHRAE Standard 135-2012, BACnet - A Data 475 Communication Protocol for Building Automation and Control 476 Networks", July 2014, 477 . 480 [Clause9] American Society of Heating, Refrigerating, and Air- 481 Conditioning Engineers, "BACnet - A Data Communication 482 Protocol for Building Automation and Control Networks", 483 ANSI/ASHRAE 135-2012 (Clause 9), March 2013. 485 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 486 Requirement Levels", BCP 14, RFC 2119, March 1997. 488 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 489 (IPv6) Specification", RFC 2460, December 1998. 491 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 492 Architecture", RFC 4291, February 2006. 494 [RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, 495 "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, 496 September 2007. 498 [RFC4862] Thomson, S., Narten, T., and T. Jinmei, "IPv6 Stateless 499 Address Autoconfiguration", RFC 4862, September 2007. 501 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 502 "Transmission of IPv6 Packets over IEEE 802.15.4 503 Networks", RFC 4944, September 2007. 505 [RFC6282] Hui, J. and P. Thubert, "Compression Format for IPv6 506 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 507 September 2011. 509 [RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, 510 "Neighbor Discovery Optimization for IPv6 over Low-Power 511 Wireless Personal Area Networks (6LoWPANs)", RFC 6775, 512 November 2012. 514 [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 515 Interface Identifiers", RFC 7136, February 2014. 517 [RFC7400] Bormann, C., "6LoWPAN-GHC: Generic Header Compression for 518 IPv6 over Low-Power Wireless Personal Area Networks 519 (6LoWPANs)", RFC 7400, November 2014. 521 14.2. Informative References 523 [COBS] Cheshire, S. and M. Baker, "Consistent Overhead Byte 524 Stuffing", IEEE/ACM TRANSACTIONS ON NETWORKING, VOL.7, 525 NO.2 , April 1999, 526 . 528 [CRC32K] Koopman, P., "32-Bit Cyclic Redundancy Codes for Internet 529 Applications", IEEE/IFIP International Conference on 530 Dependable Systems and Networks (DSN 2002) , June 2002, 531 . 534 [EUI-64] IEEE, "Guidelines for 64-bit Global Identifier (EUI-64) 535 Registration Authority", March 1997, 536 . 539 [I-D.ietf-6man-default-iids] 540 Gont, F., Cooper, A., Thaler, D., and S. LIU, 541 "Recommendation on Stable IPv6 Interface Identifiers", 542 draft-ietf-6man-default-iids-04 (work in progress), June 543 2015. 545 [I-D.ietf-6man-ipv6-address-generation-privacy] 546 Cooper, A., Gont, F., and D. Thaler, "Privacy 547 Considerations for IPv6 Address Generation Mechanisms", 548 draft-ietf-6man-ipv6-address-generation-privacy-07 (work 549 in progress), June 2015. 551 [IEEE.802.3] 552 "Information technology - Telecommunications and 553 information exchange between systems - Local and 554 metropolitan area networks - Specific requirements - Part 555 3: Carrier Sense Multiple Access with Collision Detection 556 (CMSA/CD) Access Method and Physical Layer 557 Specifications", IEEE Std 802.3-2012, December 2012, 558 . 560 [RFC2469] Narten, T. and C. Burton, "A Caution On The Canonical 561 Ordering Of Link-Layer Addresses", RFC 2469, December 562 1998. 564 [TIA-485-A] 565 Telecommunications Industry Association, "TIA-485-A, 566 Electrical Characteristics of Generators and Receivers for 567 Use in Balanced Digital Multipoint Systems (ANSI/TIA/EIA- 568 485-A-98) (R2003)", March 2003. 570 Appendix A. Abstract MAC Interface 572 This Appendix is informative and not part of the standard. 574 BACnet [Clause9] defines support for MAC-layer clients through its 575 SendFrame and ReceivedDataNoReply procedures. However, it does not 576 define a network-protocol independent abstract interface for the MAC. 577 This is provided below as an aid to implementation. 579 A.1. MA-DATA.request 581 A.1.1. Function 583 This primitive defines the transfer of data from a MAC client entity 584 to a single peer entity or multiple peer entities in the case of a 585 broadcast address. 587 A.1.2. Semantics of the Service Primitive 589 The semantics of the primitive are as follows: 591 MA-DATA.request ( 592 destination_address, 593 source_address, 594 data, 595 priority, 596 type 597 ) 599 The 'destination_address' parameter may specify either an individual 600 or a broadcast MAC entity address. It must contain sufficient 601 information to create the Destination Address field (see Section 1.3) 602 that is prepended to the frame by the local MAC sublayer entity. The 603 'source_address' parameter, if present, must specify an individual 604 MAC address. If the source_address parameter is omitted, the local 605 MAC sublayer entity will insert a value associated with that entity. 607 The 'data' parameter specifies the MAC service data unit (MSDU) to be 608 transferred by the MAC sublayer entity. There is sufficient 609 information associated with the MSDU for the MAC sublayer entity to 610 determine the length of the data unit. 612 The 'priority' parameter specifies the priority desired for the data 613 unit transfer. The priority parameter is ignored by MS/TP. 615 The 'type' parameter specifies the value of the MS/TP Frame Type 616 field that is prepended to the frame by the local MAC sublayer 617 entity. 619 A.1.3. When Generated 621 This primitive is generated by the MAC client entity whenever data 622 shall be transferred to a peer entity or entities. This can be in 623 response to a request from higher protocol layers or from data 624 generated internally to the MAC client, such as a Token frame. 626 A.1.4. Effect on Receipt 628 Receipt of this primitive will cause the MAC entity to insert all MAC 629 specific fields, including Destination Address, Source Address, Frame 630 Type, and any fields that are unique to the particular media access 631 method, and pass the properly formed frame to the lower protocol 632 layers for transfer to the peer MAC sublayer entity or entities. 634 A.2. MA-DATA.indication 636 A.2.1. Function 638 This primitive defines the transfer of data from the MAC sublayer 639 entity to the MAC client entity or entities in the case of a 640 broadcast address. 642 A.2.2. Semantics of the Service Primitive 644 The semantics of the primitive are as follows: 646 MA-DATA.indication ( 647 destination_address, 648 source_address, 649 data, 650 priority, 651 type 652 ) 654 The 'destination_address' parameter may be either an individual or a 655 broadcast address as specified by the Destination Address field of 656 the incoming frame. The 'source_address' parameter is an individual 657 address as specified by the Source Address field of the incoming 658 frame. 660 The 'data' parameter specifies the MAC service data unit (MSDU) as 661 received by the local MAC entity. There is sufficient information 662 associated with the MSDU for the MAC sublayer client to determine the 663 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 is the value of the MS/TP Frame Type field of 669 the incoming frame. 671 A.2.3. When Generated 673 The MA_DATA.indication is passed from the MAC sublayer entity to the 674 MAC client entity or entities to indicate the arrival of a frame to 675 the local MAC sublayer entity that is destined for the MAC client. 676 Such frames are reported only if they are validly formed, received 677 without error, and their destination address designates the local MAC 678 entity. Frames destined for the MAC Control sublayer are not passed 679 to the MAC client. 681 A.2.4. Effect on Receipt 683 The effect of receipt of this primitive by the MAC client is 684 unspecified. 686 Appendix B. Consistent Overhead Byte Stuffing [COBS] 688 This Appendix is informative and not part of the standard. 690 BACnet [Addendum_an] corrects a long-standing issue with the MS/TP 691 specification; namely that preamble sequences were not escaped 692 whenever they appeared in the Data or Data CRC fields. In rare 693 cases, this resulted in dropped frames due to loss of frame 694 synchronization. The solution is to encode the Data and 32-bit Data 695 CRC fields before transmission using Consistent Overhead Byte 696 Stuffing [COBS] and decode these fields upon reception. 698 COBS is a run-length encoding method that nominally removes '0x00' 699 octets from its input. Any selected octet value may be removed by 700 XOR'ing that value with each octet of the COBS output. BACnet 701 [Addendum_an] specifies the preamble octet '0x55' for removal. 703 The minimum overhead of COBS is one ectet per encoded field. The 704 worst-case overhead in long fields is bounded to one octet in 254, or 705 less than 0.4%, as described in [COBS]. 707 Frame encoding proceeds logically in two passes. The Encoded Data 708 field is prepared by passing the MSDU through the COBS encoder and 709 XOR'ing the preamble octet '0x55' with each octet of the output. The 710 Encoded CRC-32K field is then prepared by calculating a CRC-32K over 711 the Encoded Data field and formatting it for transmission as 712 described in Appendix C. The combined length of these fields, minus 713 two octets for compatibility with existing MS/TP devices, is placed 714 in the MS/TP header Length field before transmission. 716 Example COBS encoder and decoder functions are shown below for 717 illustration. Complete examples of use and test vectors are provided 718 in BACnet [Addendum_an]. 720 #include 721 #include 723 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 724 #define MSTP_PREAMBLE_X55 (0x55) 726 /* 727 * Encodes 'length' octets of data located at 'from' and 728 * writes one or more COBS code blocks at 'to', removing any 729 * 'mask' octets that may present be in the encoded data. 730 * Returns the length of the encoded data. 731 */ 733 size_t 734 cobs_encode (uint8_t *to, const uint8_t *from, size_t length, 735 uint8_t mask) 736 { 737 size_t code_index = 0; 738 size_t read_index = 0; 739 size_t write_index = 1; 740 uint8_t code = 1; 741 uint8_t data, last_code; 743 while (read_index < length) { 744 data = from[read_index++]; 745 /* 746 * In the case of encountering a non-zero octet in the data, 747 * simply copy input to output and increment the code octet. 748 */ 749 if (data != 0) { 750 to[write_index++] = data ^ mask; 751 code++; 752 if (code != 255) 753 continue; 754 } 755 /* 756 * In the case of encountering a zero in the data or having 757 * copied the maximum number (254) of non-zero octets, store 758 * the code octet and reset the encoder state variables. 759 */ 760 last_code = code; 761 to[code_index] = code ^ mask; 762 code_index = write_index++; 763 code = 1; 765 } 766 /* 767 * If the last chunk contains exactly 254 non-zero octets, then 768 * this exception is handled above (and returned length must be 769 * adjusted). Otherwise, encode the last chunk normally, as if 770 * a "phantom zero" is appended to the data. 771 */ 772 if ((last_code == 255) && (code == 1)) 773 write_index--; 774 else 775 to[code_index] = code ^ mask; 777 return write_index; 778 } 779 #include 780 #include 782 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 783 #define MSTP_PREAMBLE_X55 (0x55) 785 /* 786 * Decodes 'length' octets of data located at 'from' and 787 * writes the original client data at 'to', restoring any 788 * 'mask' octets that may present in the encoded data. 789 * Returns the length of the encoded data or zero if error. 790 */ 791 size_t 792 cobs_decode (uint8_t *to, const uint8_t *from, size_t length, 793 uint8_t mask) 794 { 795 size_t read_index = 0; 796 size_t write_index = 0; 797 uint8_t code, last_code; 799 while (read_index < length) { 800 code = from[read_index] ^ mask; 801 last_code = code; 802 /* 803 * Sanity check the encoding to prevent the while() loop below 804 * from overrunning the output buffer. 805 */ 806 if (read_index + code > length) 807 return 0; 809 read_index++; 810 while (--code > 0) 811 to[write_index++] = from[read_index++] ^ mask; 812 /* 813 * Restore the implicit zero at the end of each decoded block 814 * except when it contains exactly 254 non-zero octets or the 815 * end of data has been reached. 816 */ 817 if ((last_code != 255) && (read_index < length)) 818 to[write_index++] = 0; 819 } 820 return write_index; 821 } 823 Appendix C. Encoded CRC-32K [CRC32K] 825 This Appendix is informative and not part of the standard. 827 Extending the payload of MS/TP to 1500 octets required upgrading the 828 Data CRC from 16 bits to 32 bits. P.Koopman has authored several 829 papers on evaluating CRC polynomials for network applications. In 830 [CRC32K], he surveyed the entire 32-bit polynomial space and noted 831 some that exceed the [IEEE.802.3] polynomial in performance. BACnet 832 [Addendum_an] specifies the CRC-32K (Koopman) polynomial. 834 The specified use of the calc_crc32K() function is as follows. 835 Before a frame is transmitted, 'crc_value' is initialized to all 836 ones. After passing each octet of the [COBS] Encoded Data through 837 the function, the ones complement of the resulting 'crc_value' is 838 arranged in LSB-first order and is itself [COBS] encoded. The length 839 of the resulting Encoded CRC-32K field is always five octets. 841 Upon reception of a frame, 'crc_value' is initialized to all ones. 842 The octets of the Encoded Data field are accumulated by the 843 calc_crc32K() function before decoding. The Encoded CRC-32K field is 844 then decoded and the resulting four octets are accumulated by the 845 calc_crc32K() function. If the result is the expected residue value 846 'CRC32K_RESIDUE', then the frame was received correctly. 848 An example CRC-32K function in shown below for illustration. 849 Complete examples of use and test vectors are provided in BACnet 850 [Addendum_an]. 852 #include 854 /* See BACnet Addendum 135-2012an, section G.3.2 */ 855 #define CRC32K_INITIAL_VALUE (0xFFFFFFFF) 856 #define CRC32K_RESIDUE (0x0843323B) 858 /* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */ 859 #define CRC32K_POLY (0xEB31D82E) 861 /* 862 * Accumulate 'data_value' into the CRC in 'crc_value'. 863 * Return updated CRC. 864 * 865 * Note: crcValue must be set to CRC32K_INITIAL_VALUE 866 * before initial call. 867 */ 868 uint32_t 869 calc_crc32K (uint8_t data_value, uint32_t crc_value) 870 { 871 int b; 873 for (b = 0; b < 8; b++) { 874 if ((data_value & 1) ^ (crc_value & 1)) { 875 crc_value >>= 1; 876 crc_value ^= CRC32K_POLY; 877 } else { 878 crc_value >>= 1; 879 } 880 data_value >>= 1; 881 } 882 return crc_value; 883 } 885 Authors' Addresses 887 Kerry Lynn (editor) 888 Verizon Labs 889 50 Sylvan Rd 890 Waltham , MA 02451 891 USA 893 Phone: +1 781 296 9722 894 Email: kerlyn@ieee.org 896 Jerry Martocci 897 Johnson Controls, Inc. 898 507 E. Michigan St 899 Milwaukee , WI 53202 900 USA 902 Phone: +1 414 524 4010 903 Email: jerald.p.martocci@jci.com 905 Carl Neilson 906 Delta Controls, Inc. 907 17850 56th Ave 908 Surrey , BC V3S 1C7 909 Canada 911 Phone: +1 604 575 5913 912 Email: cneilson@deltacontrols.com 914 Stuart Donaldson 915 Honeywell Automation & Control Solutions 916 6670 185th Ave NE 917 Redmond , WA 98052 918 USA 920 Email: stuart.donaldson@honeywell.com