draft-ietf-6man-6lobac-00.txt   draft-ietf-6man-6lobac-01.txt 
IPv6 Maintenance Working Group K. Lynn, Ed. IPv6 Maintenance Working Group K. Lynn, Ed.
Internet-Draft Consultant Internet-Draft Consultant
Intended status: Standards Track J. Martocci Intended status: Standards Track J. Martocci
Expires: September 6, 2012 Johnson Controls Expires: September 13, 2012 Johnson Controls
C. Neilson C. Neilson
Delta Controls Delta Controls
S. Donaldson S. Donaldson
Honeywell Honeywell
March 5, 2012 March 12, 2012
Transmission of IPv6 over MS/TP Networks Transmission of IPv6 over MS/TP Networks
draft-ietf-6man-6lobac-00 draft-ietf-6man-6lobac-01
Abstract Abstract
MS/TP (Master-Slave/Token-Passing) is a contention-free access method MS/TP (Master-Slave/Token-Passing) is a contention-free access method
for the RS-485 physical layer that is used extensively in building for the RS-485 physical layer that is used extensively in building
automation networks. This document describes the frame format for automation networks. This document describes the frame format for
transmission of IPv6 packets and the method of forming link-local and transmission of IPv6 packets and the method of forming link-local and
statelessly autoconfigured IPv6 addresses on MS/TP networks. statelessly autoconfigured IPv6 addresses on MS/TP networks.
Status of this Memo Status of this Memo
skipping to change at page 1, line 39 skipping to change at page 1, line 39
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 6, 2012. This Internet-Draft will expire on September 13, 2012.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2012 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 29 skipping to change at page 2, line 29
8. Unicast Address Mapping . . . . . . . . . . . . . . . . . . . 10 8. Unicast Address Mapping . . . . . . . . . . . . . . . . . . . 10
9. Multicast Address Mapping . . . . . . . . . . . . . . . . . . 11 9. Multicast Address Mapping . . . . . . . . . . . . . . . . . . 11
10. Header Compression . . . . . . . . . . . . . . . . . . . . . . 11 10. Header Compression . . . . . . . . . . . . . . . . . . . . . . 11
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11
12. Security Considerations . . . . . . . . . . . . . . . . . . . 12 12. Security Considerations . . . . . . . . . . . . . . . . . . . 12
13. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12 13. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12
14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12 14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12
14.1. Normative References . . . . . . . . . . . . . . . . . . 12 14.1. Normative References . . . . . . . . . . . . . . . . . . 12
14.2. Informative References . . . . . . . . . . . . . . . . . 13 14.2. Informative References . . . . . . . . . . . . . . . . . 13
Appendix A. Extended Data CRC [CRC32K] . . . . . . . . . . . . . 14 Appendix A. Extended Data CRC [CRC32K] . . . . . . . . . . . . . 14
Appendix B. Consistent Overhead Byte Stuffing [COBS] . . . . . . 15 Appendix B. Consistent Overhead Byte Stuffing [COBS] . . . . . . 16
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 17 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 20
1. Introduction 1. Introduction
MS/TP (Master-Slave/Token-Passing) is a contention-free access method MS/TP (Master-Slave/Token-Passing) is a contention-free access method
for the RS-485 [TIA-485-A] physical layer that is used extensively in for the RS-485 [TIA-485-A] physical layer that is used extensively in
building automation networks. This document describes the frame building automation networks. This document describes the frame
format for transmission of IPv6 [RFC2460] packets and the method of format for transmission of IPv6 [RFC2460] packets and the method of
forming link-local and statelessly autoconfigured IPv6 addresses on forming link-local and statelessly autoconfigured IPv6 addresses on
MS/TP networks. The general approach is to adapt elements of the MS/TP networks. The general approach is to adapt elements of the
6LoWPAN [RFC4944] specification to constrained wired networks. 6LoWPAN [RFC4944] specification to constrained wired networks.
skipping to change at page 4, line 50 skipping to change at page 4, line 50
/ / / /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| optional 0xFF | | optional 0xFF |
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
Figure 1: MS/TP Extended Frame Format Figure 1: MS/TP Extended Frame Format
*Note: A BACnet proposal [Addendum_an], now in public review, assigns *Note: A BACnet proposal [Addendum_an], now in public review, assigns
a new Frame Type for IPv6 Encapsulation, extends the maximum length a new Frame Type for IPv6 Encapsulation, extends the maximum length
of the Data field to 1501 octets, and specifies a 32-bit Extended of the Data field to 1501 octets, and specifies a 32-bit Extended
Data CRC [CRC32K]. The Data and Extended Data CRC fields are [COBS] Data CRC [CRC32K] for these frames. The Data and Extended Data CRC
encoded and present only if Length is non-zero. fields are [COBS] encoded and present only if Length is non-zero.
The MS/TP frame fields have the following descriptions**: The MS/TP frame fields have the following descriptions**:
Preamble two octet preamble: 0x55, 0xFF Preamble two octet preamble: 0x55, 0xFF
Frame Type one octet Frame Type one octet
Destination Address one octet address Destination Address one octet address
Source Address one octet address Source Address one octet address
Length two octets, most significant octet first Length two octets, most significant octet first
Header CRC one octet Header CRC one octet
Data 0 - 1501 octets** Data 0 - 1501 octets**
skipping to change at page 5, line 46 skipping to change at page 5, line 46
Data and Extended Data CRC fields in octets, minus two. (Note: This Data and Extended Data CRC fields in octets, minus two. (Note: This
trick is required for co-existence with legacy MS/TP devices.) See trick is required for co-existence with legacy MS/TP devices.) See
Section 4 and Appendices for additional details. Section 4 and Appendices for additional details.
The Header CRC field covers the Frame Type, Destination Address, The Header CRC field covers the Frame Type, Destination Address,
Source Address, and Length fields. The Header CRC generation and Source Address, and Length fields. The Header CRC generation and
check procedures are specified in [BACnet]. check procedures are specified in [BACnet].
**The Data and Extended Data CRC fields are conditional on the Frame **The Data and Extended Data CRC fields are conditional on the Frame
Type and the Length and will always be present in frames specified by Type and the Length and will always be present in frames specified by
this document. These fields are concatenated and encoded as a unit this document. These fields are concatenated and then encoded before
before transmission using Consistent Overhead Byte Stuffing [COBS] to transmission using Consistent Overhead Byte Stuffing [COBS] to remove
remove preamble sequences from the fields. The Extended Data CRC and preamble sequences from the fields. The Extended Data CRC and COBS
COBS encoding procedures are specified in the BACnet [Addendum_an] encoding procedures are specified in the BACnet [Addendum_an] change
change proposal and briefly summarized in Apendices A and B below. proposal and briefly summarized in Appendices A and B below.
1.4. Goals and Non-goals 1.4. Goals and Non-goals
The primary goal of this specification is to enable IPv6 directly to The primary goal of this specification is to enable IPv6 directly to
wired end devices in building automation and control networks, while wired end devices in building automation and control networks, while
leveraging existing standards to the greatest extent possible. A leveraging existing standards to the greatest extent possible. A
secondary goal is to co-exist with legacy MS/TP implementations. secondary goal is to co-exist with legacy MS/TP implementations.
Only the minimum changes necessary to support IPv6 over MS/TP are Only the minimum changes necessary to support IPv6 over MS/TP are
proposed in BACnet [Addendum_an] (see note in Section 1.3). proposed in BACnet [Addendum_an] (see note in Section 1.3).
skipping to change at page 14, line 7 skipping to change at page 14, line 7
December 1998. December 1998.
[TIA-485-A] [TIA-485-A]
Telecommunications Industry Association, "TIA-485-A, Telecommunications Industry Association, "TIA-485-A,
Electrical Characteristics of Generators and Receivers for Electrical Characteristics of Generators and Receivers for
Use in Balanced Digital Multipoint Systems (ANSI/TIA/ Use in Balanced Digital Multipoint Systems (ANSI/TIA/
EIA-485-A-98) (R2003)", March 2003. EIA-485-A-98) (R2003)", March 2003.
Appendix A. Extended Data CRC [CRC32K] Appendix A. Extended Data CRC [CRC32K]
This Appendix is informative and not part of the standard.
Extending the payload of MS/TP to 1501 octets requires upgrading the
Data CRC from 16 bits to 32 bits. Koopman has published several
papers on choosing the right CRC polynomial for the application. In
[CRC32K], he surveyed the entire 32-bit polynomial space and
identified some that exceed the 802.3 polynomial in performance.
The BACnet MS/TP change proposal [Addendum_an] specifies the CRC32K
(Koopman) polynomial. An example C implementation is shown below.
The specified use of the function is that 'crcValue' is initialized
to all ones before the function is first called and, upon running the
function over all octets in the payload, the ones complement of
'crcValue' be sent in LSB-first order. Upon reception, the data
field and modified 'crcValue' are passed again through the function.
If these fields were properly received, the result of the function
will be 'CRC32K_RESIDUE'.
#include <stdint.h> #include <stdint.h>
/* See 135-2010 Addendum an, section G.3.2 */ /* See ASHRAE 135-2010 Addendum an, section G.3.2 */
#define CRC32K_INITIAL_VALUE (0xFFFFFFFF) #define CRC32K_INITIAL_VALUE (0xFFFFFFFF)
#define CRC32K_RESIDUE (0x0843323B) #define CRC32K_RESIDUE (0x0843323B)
/* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */
#define CRC32K_POLY (0xEB31D82E)
/* Accumulate "dataValue" into the CRC in "crcValue". /*
* Return value is updated CRC. * Accumulate 'dataValue' into the CRC in 'crcValue'.
* Return updated CRC.
* *
* Note: crcValue must be set to CRC32K_INITIAL_VALUE * Note: crcValue must be set to CRC32K_INITIAL_VALUE
* before initial call. * before initial call.
*/ */
unsigned long uint32_t
CalcExtendedDataCRC(uint8_t dataValue, uint32_t crcValue) CalcExtendedDataCRC(uint8_t dataValue, uint32_t crcValue)
{ {
uint8_t data, b; uint8_t data, b;
uint32_t crc; uint32_t crc;
data = dataValue; data = dataValue;
crc = crcValue; crc = crcValue;
for (b = 0; b < 8; b++) { for (b = 0; b < 8; b++) {
if ((data & 1) ^ (crc & 1)) { if ((data & 1) ^ (crc & 1)) {
crc >>= 1; crc >>= 1;
/* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */ crc ^= CRC32K_POLY;
crc ^= 0xEB31D82E;
} else { } else {
crc >>= 1; crc >>= 1;
} }
data >>= 1; data >>= 1;
} }
return crc; return crc;
} }
Appendix B. Consistent Overhead Byte Stuffing [COBS] Appendix B. Consistent Overhead Byte Stuffing [COBS]
This Appendix is informative and not part of the standard.
The BACnet change proposal [Addendum_an] corrects a long-standing
issue with the MS/TP specification; namely that preamble sequences
were not escaped whenever they appeared in the Data or Data CRC
fields. In some cases, this could result in dropped frames due to
mis-alignment. The solution is encode the Data and Extended Data CRC
fields before transmission using Consistent Overhead Byte Stuffing
[COBS] and decode these fields upon reception.
COBS is a run-length encoding method that effectively removes '0x00'
octets from its input. The worst-case overhead is bounded at approx.
one octet in 254, or less than 0.5%, as described in [COBS]. An
aribtrary octet value may be removed by XOR'ing the COBS output with
the specified value. In the case of MS/TP, the '0x55' preamble octet
is specified for removal.
Encoding proceeds logically in three passes. First, the Extended
Data CRC is calculated over the data, modified for transmission as
described in Appendix A, and appended to the data. The combined
fields are then passed through the COBS encoder. The resulting
output is then XOR'd with the MS/TP preamble octet '0x55'. The
length of the encoded fields, minus two octets for compatibility with
existing MS/TP devices, is placed in the MS/TP header Length field
before transmission.
An example C implementation that combines these passes is shown
below. The decode() function is the inverse of the encode()
function.
#include <stdint.h> #include <stdint.h>
#define INVERT_MSTP_PREAMBLE_55 (0x55) #define MSTP_PREAMBLE_55 (0x55)
/* /*
* Encodes "length" bytes of data at the location pointed to by "input", * Encodes 'length' octets of data at the location pointed to by 'input'
* writing the output to the location pointed to by "output". * and writes the output to the location pointed to by 'output'.
* Returns the number of bytes written to "output". * Returns the number of octets written to 'output'.
*/ */
size_t size_t
cobs_encode (uint8_t *output, const uint8_t *input, size_t length) frame_encode (uint8_t *output, const uint8_t *input, size_t length)
{ {
size_t code_index = 0; size_t code_index = 0;
size_t read_index = 0; size_t read_index = 0;
size_t write_index = 1; size_t write_index = 1;
uint8_t code = 1; uint8_t code = 1;
uint8_t data, last_code; uint8_t data;
int i;
while (read_index < length) { uint32_t crc32K = CRC32K_INITIAL_VALUE;
data = input[read_index++];
/* while (read_index < length) {
* In the common case, simply copy input to output and data = input[read_index++];
* increment the number of bytes copied. crc32K = CalcExtendedDataCRC(data, crc32K);
*/
if (data != 0) {
output[write_index++] = data;
code++;
if (code != 0xFF)
continue;
}
/*
* In the special case of encountering a zero in the input or
* having copied the maximum number (254) of non-zero octets,
* store the count and re-initialize encoder variables.
*/
output[code_index] = code;
code_index = write_index++;
last_code = code;
code = 1;
}
/* /*
* If the last octet in the input was non-zero, store the count. * In the common case, simply copy input to output and
* increment the number of octets copied.
*/ */
if (last_code < 255) { if (data != 0) {
output[code_index] = code; output[write_index++] = (data ^ MSTP_PREAMBLE_55);
write_index++; code++;
if (code != 0xFF)
continue;
} }
/*
* In the special case of encountering a zero in the input or
* having copied the maximum number (254) of non-zero octets,
* store the count and re-initialize encoder variables.
*/
output[code_index] = (code ^ MSTP_PREAMBLE_55);
code_index = write_index++;
code = 1;
}
/*
* Run the one's complement of the CRC value through the encoder,
* LSB first.
*/
crc32K = ~crc32K;
for (i = 0; i < 4; i++) {
data = ((uint8_t *) &crc32K)[i];
return --write_index; if (data != 0) {
output[write_index++] = (data ^ MSTP_PREAMBLE_55);
code++;
if (code != 0xFF)
continue;
}
/*
* In the special case of encountering a zero in the input or
* having copied the maximum number (254) of non-zero octets,
* store the count and re-initialize encoder variables.
*/
output[code_index] = (code ^ MSTP_PREAMBLE_55);
code_index = write_index++;
last_code = code;
code = 1;
}
/* Append a "phantom zero" to the output stream. */
output[code_index] = (code ^ MSTP_PREAMBLE_55);
/*
* Return the combined value of the Data and Extended CRC fields.
* Subtract two before use as the MS/TP frame Length field.
*/
return write_index;
} }
/*
* Takes COBS encoded Data and Extended Data CRC fields as 'input'.
* The 'length' contains the actual length of these fields in
* octets (that is, the header Length field plus two).
* Decodes the Data and Extended Data CRC fields into 'output'.
* Returns length of decoded Data in octets.
* Note: Safe to call with 'output' <= 'input'.
*/
size_t
frame_decode (uint8_t *output, const uint8_t *input, size_t length)
{
uint16_t read_index = 0;
uint16_t write_index = 0;
uint8_t code, data;
int i;
/* crc32 = CRC32K_INITIAL_VALUE;
* Takes COBS encoded Data and Extended Data CRC fields as "input". while (read_index < length) {
* Decodes the Data and Extended Data CRC fields into "output". code = (input[read_index] ^ MSTP_PREAMBLE_55);
* Returns length of decoded Data in octets. /*
* Note: Safe to call with "output" <= "input". * Sanity check the encoding to prevent the for() loop below
*/ * from overrunning the output buffer.
size_t */
frame_decode (uint8_t *output, const uint8_t *input, size_t length) if ((read_index + code) > length)
{ return 0;
uint16_t read_index = 0;
uint16_t write_index = 0;
uint8_t code, data;
int i;
crc32 = CRC32K_INITIAL_VALUE; read_index++;
while (read_index < length) {
code = (input[read_index] ^ INVERT_MSTP_PREAMBLE_55); for (i = 1; i < code; i++) {
/* data = (input[read_index++] ^ MSTP_PREAMBLE_55);
* Sanity check the encoding to prevent the for() loop below crc32 = CalcExtendedDataCRC(data, crc32);
* from overrunning the output buffer. output[write_index++] = data;
*/ }
if ((read_index + code) > length) { if ((code < 0xFF) && (read_index < length)) {
return 0; data = '\0';
} crc32 = CalcExtendedDataCRC(data, crc32);
read_index++; output[write_index++] = data;
}
}
if (crc32K == CRC32K_RESIDUE)
return write_index - sizeof(uint32_t);
else
return 0;
}
for (i = 1; i < code; i++) {
data = (input[read_index++] ^ INVERT_MSTP_PREAMBLE_55);
crc32 = CalcExtendedDataCRC(data, crc32);
output[write_index++] = data;
}
if ((code < 0xFF) && (read_index < length)) {
data = '\0';
crc32 = CalcExtendedDataCRC(data, crc32);
output[write_index++] = data;
}
}
return write_index - sizeof(guint32);
}
Authors' Addresses Authors' Addresses
Kerry Lynn (editor) Kerry Lynn (editor)
Consultant Consultant
Phone: +1 978 460 4253 Phone: +1 978 460 4253
Email: kerlyn@ieee.org Email: kerlyn@ieee.org
Jerry Martocci Jerry Martocci
Johnson Controls, Inc. Johnson Controls, Inc.
 End of changes. 28 change blocks. 
94 lines changed or deleted 174 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/