idnits 2.17.1 draft-ietf-cbor-network-addresses-05.txt: -(5): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding 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: ---------------------------------------------------------------------------- == There are 2 instances of lines with non-ascii characters in the document. 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 -- The document date (12 July 2021) is 1016 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) No issues found here. Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CBOR Working Group M. Richardson 3 Internet-Draft Sandelman Software Works 4 Intended status: Standards Track C. Bormann 5 Expires: 13 January 2022 Universität Bremen TZI 6 12 July 2021 8 CBOR tags for IPv4 and IPv6 addresses and prefixes 9 draft-ietf-cbor-network-addresses-05 11 Abstract 13 This document describes two CBOR Tags to be used with IPv4 and IPv6 14 addresses and prefixes. 16 RFC-EDITOR-please remove: This work is tracked at https://github.com/ 17 cbor-wg/cbor-network-address 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at https://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on 13 January 2022. 36 Copyright Notice 38 Copyright (c) 2021 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 43 license-info) in effect on the date of publication of this document. 44 Please review these documents carefully, as they describe your rights 45 and restrictions with respect to this document. Code Components 46 extracted from this document must include Simplified BSD License text 47 as described in Section 4.e of the Trust Legal Provisions and are 48 provided without warranty as described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 53 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 2 54 3. Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . 3 55 3.1. IPv6 . . . . . . . . . . . . . . . . . . . . . . . . . . 3 56 3.2. IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 4. Encoder Consideration for prefixes . . . . . . . . . . . . . 4 58 5. Decoder Considerations for prefixes . . . . . . . . . . . . . 5 59 6. CDDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 60 7. Security Considerations . . . . . . . . . . . . . . . . . . . 6 61 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 62 8.1. Tag 54 - IPv6 . . . . . . . . . . . . . . . . . . . . . . 7 63 8.2. Tag 52 - IPv4 . . . . . . . . . . . . . . . . . . . . . . 7 64 9. Normative References . . . . . . . . . . . . . . . . . . . . 7 65 Appendix A. Changelog . . . . . . . . . . . . . . . . . . . . . 7 66 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 8 67 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8 69 1. Introduction 71 [RFC8949] defines a number of CBOR Tags for common items. 73 Tag 260 and tag 261 was later defined through IANA. These tags cover 74 addresses (260), and prefixes (261). Tag 260 distinguishes between 75 IPv4, IPv6 and Ethernet through the length of the byte string only. 76 Tag 261 was not documented well enough to be used. 78 The present specification achieves an explicit indication of IPv4 or 79 IPv6, and the possibility to omit trailing zeroes. 81 This document provides a format for IPv6 and IPv4 addresses, 82 prefixes, and addresses with prefixes. Prefixes MUST omit trailing 83 zeroes in the address. Due to the complexity of testing the value of 84 omitting trailing zeros for addresses was considered non-essential 85 and support for that was removed in this specification. 87 This document does not deal with 6 or 8-byte Ethernet addressees. 89 2. Terminology 91 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 92 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 93 "OPTIONAL" in this document are to be interpreted as described in 94 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 95 capitals, as shown here. 97 3. Protocol 99 These tags can applied to byte strings to represent a single address. 101 When applied to an array that starts with a number, they represent a 102 CIDR-style prefix of that length. When a byte string (without 103 prefix) appears in a context where a prefix is expected, then it is 104 to be assumed that all bits are relevant. That is, for IPv4, a /32 105 is implied, and for IPv6, a /128 is implied. 107 When applied to an array that starts with a byte string, that stands 108 for an IP address, followed by the bit length of a prefix built out 109 of the first "length" bits of the address. 111 3.1. IPv6 113 IANA has allocated tag 54 for IPv6 uses. (Note that this is the 114 ASCII code for '6'.) 116 An IPv6 address is to be encoded as a sixteen-byte byte string 117 (Section 3.1 of [RFC8949], major type 2), enclosed in Tag number 54. 119 An IPv6 prefix, such as 2001:db8:1234::/48 is to be encoded as a two 120 element array, with the length of the prefix first. Trailing zero 121 bytes MUST be omitted. 123 For example: 125 54([ 48, h'20010db81234']) 127 An IPv6 address combined with a prefix length, such as being used for 128 configuring an interface, is to be encoded as a two element array, 129 with the (full-length) IPv6 address first and the length of the 130 associated network the prefix next. 132 For example: 134 54([h'20010db81234DEEDBEEFCAFEFACEFEED', 56]) 136 Note that the address-with-prefix form can be reliably distinguished 137 from the prefix form only in the sequence of the array elements. 139 3.2. IPv4 141 IANA has allocated tag 52 for IPv4 uses. (Note that this is the 142 ASCII code for '4'.) 143 An IPv4 address is to be encoded as a four-byte byte string 144 (Section 3.1 of [RFC8949], major type 2), enclosed in Tag number 52. 146 An IPv4 prefix, such as 192.0.2.0/24 is to be encoded as a two 147 element array, with the length of the prefix first. Trailing zero 148 bytes MUST be omitted. 150 For example: 152 52([ 24, h'C00002']) 154 An IPv4 address combined with a prefix length, such as being used for 155 configuring an interface, is to be encoded as a two element array, 156 with the (full-length) IPv4 address first and the length of the 157 associated network the prefix next. 159 For example, 192.0.2.1/24 is to be encoded as a two element array, 160 with the length of the prefix (implied 192.0.2.0/24) last. 162 52([ h'C0000201', 24]) 164 Note that the address-with-prefix form can be reliably distinguished 165 from the prefix form only in the sequence of the array elements. 167 4. Encoder Consideration for prefixes 169 An encoder may omit as many right-hand (trailing) bytes which are all 170 zero as it wishes. 172 There is no relationship between the number of bytes omitted and the 173 prefix length. For instance, the prefix 2001:db8::/64 is optimally 174 encoded as: 176 54([64, h'20010db8']) 178 An encoder MUST take care to set all trailing bits to zero. While 179 decoders are expected to ignore them, such garbage entities could be 180 used as a covert channel, or may reveal the state of what would 181 otherewise be private memory contents. So for example, 182 2001:db8:1230::/44 MUST be encoded as: 184 52([44, h'20010db81230']) 186 even though variations like: 188 54([44, h'20010db81233']) WRONG 189 54([45, h'20010db8123f']) WRONG 190 would be parsed in the exact same way. 192 The same considerations apply to IPv4 prefixes. 194 5. Decoder Considerations for prefixes 196 A decoder MUST consider all bits to the right of the prefix length to 197 be zero. 199 A decoder MUST handle the case where a prefix length specifies that 200 more bits are relevant than are actually present in the byte-string. 201 As a pathological case, ::/128 can be encoded as 203 54([128, h'']) 205 A recommendation for implementation is to first create an array of 16 206 (or 4) bytes in size, set it all to zero. 208 Then looking at the length of the included byte-string, and of the 209 prefix-length, rounded up to the next multiple of 8, and taking 210 whichever is smaller, copy that many bytes from the byte-string into 211 the array. 213 Finally, looking at the last three bits of the prefix-length (that 214 is, the prefix-length modulo 8), use a static array of 8 values to 215 force the lower bits, non-relevant bits to zero. 217 A particularly paranoid decoder could examine the lower non-relevant 218 bits to determine if they are non-zero, and reject the prefix. This 219 would detect non-compliant encoders, or a possible covert channel. 221 6. CDDL 223 For use with CDDL [RFC8610], the typenames defined in Figure 1 are 224 recommended: 226 ip-address-or-prefix = ipv6-address-or-prefix / 227 ipv4-address-or-prefix 229 ipv6-address-or-prefix = #6.54(ipv6-address / 230 ipv6-address-with-prefix / 231 ipv6-prefix) 232 ipv4-address-or-prefix = #6.52(ipv4-address / 233 ipv4-address-with-prefix / 234 ipv4-prefix) 236 ipv6-address = bytes .size 16 237 ipv4-address = bytes .size 4 239 ipv6-address-with-prefix = [ipv6-address, ipv6-prefix-length] 240 ipv4-address-with-prefix = [ipv4-address, ipv4-prefix-length] 242 ipv6-prefix-length = 0..128 243 ipv4-prefix-length = 0..32 245 ipv6-prefix = [ipv6-prefix-length, ipv6-prefix-bytes] 246 ipv4-prefix = [ipv4-prefix-length, ipv4-prefix-bytes] 248 ipv6-prefix-bytes = bytes .size (uint .le 16) 249 ipv4-prefix-bytes = bytes .size (uint .le 4) 251 Figure 1 253 7. Security Considerations 255 Identifying which byte sequences in a protocol are addresses may 256 allow an attacker or eavesdropper to better understand what parts of 257 a packet to attack. 259 Reading the relevant RFC may provide more information, so it would 260 seem that any additional security that was provided by not being able 261 to identify what are IP addresses falls into the security by 262 obscurity category. 264 The right-hand bits of the prefix, after the prefix-length, are 265 ignored by this protocol. A malicious party could use them to 266 transmit covert data in a way that would not affect the primary use 267 of this encoding. Such abuse would be detected by examination of the 268 raw protocol bytes. Users of this encoding should be aware of this 269 possibility. 271 8. IANA Considerations 273 IANA has allocated two tags from the Specification Required area of 274 the Concise Binary Object Representation (CBOR) Tags: 276 8.1. Tag 54 - IPv6 278 Data Item: byte string or array 279 Semantics: IPv6, [prefixlen,IPv6], [IPv6,prefixpart] 281 8.2. Tag 52 - IPv4 283 Data Item: byte string or array 284 Semantics: IPv4, [prefixlen,IPv4], [IPv4,prefixpart] 286 9. Normative References 288 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 289 Requirement Levels", BCP 14, RFC 2119, 290 DOI 10.17487/RFC2119, March 1997, 291 . 293 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 294 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 295 May 2017, . 297 [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data 298 Definition Language (CDDL): A Notational Convention to 299 Express Concise Binary Object Representation (CBOR) and 300 JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, 301 June 2019, . 303 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 304 Representation (CBOR)", STD 94, RFC 8949, 305 DOI 10.17487/RFC8949, December 2020, 306 . 308 Appendix A. Changelog 310 This section is to be removed before publishing as an RFC. 312 * 03 314 * 02 316 * 01 added security considerations about covert channel 318 Acknowledgements 320 none yet 322 Authors' Addresses 324 Michael Richardson 325 Sandelman Software Works 327 Email: mcr+ietf@sandelman.ca 329 Carsten Bormann 330 Universität Bremen TZI 331 Germany 333 Email: cabo@tzi.org