RFC 2673

Binary Labels in the Domain Name System

πŸ“… published August 1999, from ietf

RFC 2673: Binary Labels in the Domain Name System πŸŽ€

okay bestie, so this one is by Matt Crawford from Fermilab, and it's a Standards Track doc dated August 1999 πŸ¦‹ It doesn't list anything it obsoletes or updates, so it's a fresh standalone spec. It defines a new kind of DNS label, the Bit-String Label, so you can store records at any bit boundary in a binary-named part of the namespace. Iconic πŸ’…

Status of This Memo

This doc specifies an Internet standards track protocol for the Internet community, and it's asking everyone for discussion and suggestions πŸ’¬ For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited ✨

Copyright (C) The Internet Society (1999). All Rights Reserved. πŸ”’

1. Introduction and Terminology ✨

So this section introduces the Bit-String Label 🌸 It can show up inside domain names, and it packs a whole sequence of One-Bit Labels into something compact. That's what lets resource records live at any bit-boundary in a binary-named chunk of the domain name tree. Main character energy πŸ‘‘

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be read as described in [KWORD]. πŸ“–

2. Motivation 🧚

Okay, the why: binary labels are meant to solve storing data and delegating authority on arbitrary boundaries, efficiently, when the name space is most naturally a binary structure. Makes sense, right? 🫢

3. Label Format πŸ¦‹

Up to 256 One-Bit Labels can be grouped into one Bit-String Label πŸ“ Inside a Bit-String Label, the most significant or "highest level" bit comes first. This is kinda the opposite of regular DNS labels, which put the least significant or "lowest level" label first. But honestly this ordering is the most natural and efficient way to represent binary labels, so it's giving logic 🧠

Between consecutive Bit-String Labels, the bits in the first-appearing label are less significant, or "at a lower level," than the bits in the later ones. Same way ASCII labels are ordered ✨

3.1. Encoding πŸ’–

   0                   1                   2
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2     . . .
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+
  |0 1|    ELT    |     Count     |           Label ...         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+//-+-+-+-+-+-+-+

(Each tic mark represents one bit.) πŸ”

ELT is 000001 in binary, which is the six-bit extended label type [EDNS0] assigned to the Bit-String Label πŸŽ€

Count is the number of significant bits in the Label field. A Count value of zero means 256 bits are significant. So the null label for the DNS root can't be represented as a Bit-String Label, because that would be zero bits πŸ™ˆ

Label is the bit string representing a sequence of One-Bit Labels, with the most significant bit first. So the One-Bit Label in position 17 in the diagram above is a subdomain of the one in position 16, and so on 🌈

The Label field gets padded on the right with zero to seven pad bits so the whole field fills an integral number of octets. These pad bits MUST be zero on transmission and ignored on reception 🫢 (Wait, I need to be careful with that one. The MUST here is the requirement, so it stays in capitals, and the rest of the sentence is just vibes.)

A sequence of bits can get split into two or more Bit-String Labels, but the division points don't mean anything and don't need to be preserved πŸ’… An excessively clever server might split them up to squeeze out the most from message compression [DNSIS]. A simpler server might just divide Bit-String Labels at zone boundaries, if any zone boundaries happen to fall between One-Bit Labels 🧚

3.2. Textual Representation ✨

In text, like in a zone file for example, a Bit-String Label looks like a <bit-spec> wrapped in the delimiters "[" and "]" πŸ“ The <bit-spec> is either a dotted quad, or a base indicator plus digits in that base, optionally followed by a slash and a length. The base indicators are "b", "o", and "x", for base 2, 8, and 16 🌸

The length counts the significant bits. After a dotted quad it MUST be between 1 and 32, inclusive. After one of the other forms it MUST be between 1 and 256, inclusive. If you leave the length off, the implicit length is 32 for a dotted quad, or 1, 3, or 4 times the number of binary, octal, or hexadecimal digits you supplied, respectively, for the other forms πŸ”₯

Here's the grammar, in augmented Backus-Naur form [ABNF] πŸ“–

  bit-string-label =  "\[" bit-spec "]"

  bit-spec         =  bit-data [ "/" length ]
                    / dotted-quad [ "/" slength ]

  bit-data         =  "x" 1*64HEXDIG
                    / "o" 1*86OCTDIG
                    / "b" 1*256BIT

  dotted-quad      =  decbyte "." decbyte "." decbyte "." decbyte

  decbyte          =  1*3DIGIT

  length           =  NZDIGIT *2DIGIT

  slength          =  NZDIGIT [ DIGIT ]

  OCTDIG           =  %x30-37

  NZDIGIT          =  %x31-39

If a <length> is present, the number of digits in the <bit-data> MUST be just enough to hold the number of bits the <length> specifies. If there are insignificant bits in a final hexadecimal or octal digit, they MUST be zero. A <dotted-quad> always has all four parts, even if the matching <slength> is less than 24. But like the other forms, its insignificant bits MUST be zero too πŸ’œ

Each number represented by a <decbyte> must be between 0 and 255, inclusive. The number represented by <length> must be between 1 and 256, inclusive. The number represented by <slength> must be between 1 and 32, inclusive πŸ™ˆ

When a machine generates the textual form of a Bit-String Label, the length SHOULD be explicit, not implicit ✨

3.2.1. Examples 🌈

These four textual forms all represent the same Bit-String Label πŸ¦‹

                             \[b11010000011101]
                             \[o64072/14]
                             \[xd074/14]
                             \[208.116.0.0/14]

This one represents two consecutive Bit-String Labels, which point to the same relative spot in the DNS tree as any of the single Bit-String Labels above πŸŽ€

                             \[b11101].\[o640]

3.3. Canonical Representation and Sort Order πŸ”

Both the wire form and the text form of binary labels have some flexibility in how they're grouped into multiple consecutive Bit-String Labels. But when you're generating or checking DNS signature records [DNSSEC], the binary labels have to be in a predictable form. That canonical form is defined as the one with the fewest possible Bit-String Labels, where every label in a sequence of consecutive Bit-String Labels is at maximum length, except possibly the first (least significant) one 🫢

For example, any sequence of up to 256 One-Bit Labels has a single Bit-String Label in its canonical form. And a sequence of 513 to 768 One-Bit Labels has three Bit-String Labels, where the second and third each hold 256 label bits πŸ’–

The canonical sort order of domain names [DNSSEC] gets extended to cover binary labels, like this. Sorting is still label-by-label, from most to least significant. A label can now be a One-Bit Label or a standard (code 00) label. Any One-Bit Label sorts before any standard label, and a 0 bit sorts before a 1 bit. The absence of a label sorts before any label, as [DNSSEC] specifies 🌸

Here's a correctly sorted list of domain names πŸ“

                     foo.example
                     \[b1].foo.example
                     \[b100].foo.example
                     \[b101].foo.example
                     bravo.\[b10].foo.example
                     alpha.foo.example

4. Processing Rules πŸ’…

A One-Bit Label never matches any other kind of label. In particular, the DNS labels written as the single ASCII characters "0" and "1" don't match One-Bit Labels with the bit values 0 and 1. Not the same thing at all πŸ™…β€β™€οΈ

5. Discussion 🌸

A Count of zero in the wire form means a 256-bit sequence. This isn't about optimizing that one case. It's about making a zero-bit label completely impossible 🧠

6. IANA Considerations πŸ“œ

This doc defines one Extended Label Type, called the Bit-String Label, and asks for registration of the code point 000001 (binary) in the space defined by [EDNS0] ✨

7. Security Considerations πŸ”

Every security consideration that applies to traditional ASCII DNS labels applies equally to binary labels. Yep, same rules, no exceptions 😭 The canonicalization and sorting rules in Section 3.3 let these be handled by DNS Security [DNSSEC]. Take this seriously, bestie, because misreading these is how you end up with a broken zone πŸ’€

8. References πŸ“š

[ABNF]   Crocker, D. and P. Overell, "Augmented BNF for Syntax
         Specifications: ABNF", RFC 2234, November 1997.

[DNSIS]  Mockapetris, P., "Domain names - implementation and
         specification", STD 13, RFC 1035, November 1987.

[DNSSEC] Eastlake, D., 3rd, C. Kaufman, "Domain Name System Security
         Extensions", RFC 2065, January 1997

[EDNS0]  Vixie, P., "Extension mechanisms for DNS (EDNS0)", RFC 2671,
         August 1999.

[KWORD]  Bradner, S., "Key words for use in RFCs to Indicate
         Requirement Levels," BCP 14, RFC 2119, March 1997.

9. Author's Address πŸ¦‹

Matt Crawford
Fermilab MS 368
PO Box 500
Batavia, IL 60510
USA

Phone: +1 630 840-3461
EMail: crawdad@fnal.gov

Copyright (C) The Internet Society (1999). All Rights Reserved.

You're allowed to copy this doc and share it, and you can make derivative works that comment on or explain it, or help with implementing it. You can publish and distribute those, in whole or in part, with no real restrictions, as long as the copyright notice and this paragraph stay on every copy and derivative work 🫢 But the doc itself can't be modified in any way, like removing the copyright notice or the references to the Internet Society or other Internet organizations. The exception is when you need it for developing Internet standards, and then the copyright procedures in the Internet Standards process must be followed. You can also translate it into languages other than English 🌸

Those permissions are perpetual and won't be revoked by the Internet Society or its successors or assigns ✨

This document and the info in it is provided "AS IS", and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT USING THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS, OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE πŸ’…

Acknowledgement πŸ’–

Funding for the RFC Editor function is currently provided by the Internet Society πŸŽ€

πŸ“¦ where this page comes from