Subject: [Cbor] CBOR tags for IPv4 and IPv6 addresses and prefixes

From: Michael Richardson <[email-masked]>
Date: Mon, 25 Jan 2021 15:21:15 -0500

I was not satisfied with the semantics of tag 260 and 261.

The IP address type is determined by the length of the item.
Aside from lacking semantic meaning, it forces me to put all the trailing zeros in.
(Also IEEE now has 8-byte MAC addresses)

I'm happy to leave 260 for mac addresses though.
Should the prefix length go first perhaps?

I prefer the encoding given below (oops got my Doc prefix for IPv4 wrong in
document, fixed below):

## IPv6

IANA has allocated tag TBD1 for IPv6 uses.

An IPv6 address is to be encoded as up to sixteen-byte bytestring ({{RFC8949}} section, 3.1, major type 2), prefixed with tag TBD1.  Trailing zero octets may be omitted.

An IPv6 prefix, such as 2001:db8:1234::/48 is to be encoded as a two element array:

~~~~
    TBD1([ h'20010db81234', 24])
~~~~

## IPv4

IANA has allocated tag TBD2 for IPv4 uses.

An IPv4 address is to be encoded as a four-byte bytestring ({{RFC8949}} section, 3.1, major type 2), prefixed with tag TBD2. Trailing zero octets may be omitted.

An IPv4 prefix, such as 192.0.2.1/24 is to be encoded as a two element array:

~~~~
    TBD2([ h'C0000201', 24])
~~~~

[email-masked] wrote:
    > A new version of I-D, draft-richardson-cbor-network-addresses-00.txt
    > has been successfully submitted by Michael Richardson and posted to the
    > IETF repository.

    > Name: draft-richardson-cbor-network-addresses Revision: 00 Title: CBOR
    > tags for IPv4 and IPv6 addresses and prefixes Document date: 2021-01-25
    > Group: Individual Submission Pages: 4 URL:
    > https://www.ietf.org/archive/id/draft-richardson-cbor-network-addresses-00.txt
    > Status:
    > https://datatracker.ietf.org/doc/draft-richardson-cbor-network-addresses/
    > Html:
    > https://www.ietf.org/archive/id/draft-richardson-cbor-network-addresses-00.html
    > Htmlized:
    > https://tools.ietf.org/html/draft-richardson-cbor-network-addresses-00

    > Abstract: This document describes two CBOR Tags to be used with IPv4
    > and IPv6 addresses and prefixes.

    >    RFC-EDITOR-please remove: This work is tracked at
    > https://github.com/mcr/cbor-network-address.git

    > Please note that it may take a couple of minutes from the time of
    > submission until the htmlized version and diff are available at
    > tools.ietf.org.

    > The IETF Secretariat

--
Michael Richardson <[email-masked]>   . o O ( IPv6 IøT consulting )
           Sandelman Software Works Inc, Ottawa and Worldwide

---

From: Christian Amsüss <[email-masked]>
Date: Fri, 29 Jan 2021 10:49:06 +0100

Hello CBOR group,

> I was not satisfied with the semantics of tag 260 and 261.

Have there been positive experiences in the group with tag 260?

In particular, I'm thinking of draft-ietf-core-href which, for the
payload of its host.ip production, uses the same length dispatch between
IPv4 and IPv6 (in an untagged form).

Or with tag 261? (which sounds a bit odder for its use of a map).

BR
Christian

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom

---

From: Michael Richardson <[email-masked]>
Date: Fri, 29 Jan 2021 12:02:32 -0500

> payload of its host.ip production, uses the same length dispatch
    > between IPv4 and IPv6 (in an untagged form).

A complaint is that this requires 8 zero bytes when describing a typical /64
prefix.