Re: [DNSOP] SVCB and HTTPSSVC records: draft-nygren-dnsop-svcb-httpssvc-00

Mark Andrews <marka@isc.org> Fri, 27 September 2019 00:42 UTC

Return-Path: <marka@isc.org>
X-Original-To: dnsop@ietfa.amsl.com
Delivered-To: dnsop@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 154DE120ABB for <dnsop@ietfa.amsl.com>; Thu, 26 Sep 2019 17:42:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.899
X-Spam-Level:
X-Spam-Status: No, score=-6.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jfWPVFY5wAgn for <dnsop@ietfa.amsl.com>; Thu, 26 Sep 2019 17:42:19 -0700 (PDT)
Received: from mx.pao1.isc.org (mx.pao1.isc.org [IPv6:2001:4f8:0:2::2b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 74ABD120AA1 for <dnsop@ietf.org>; Thu, 26 Sep 2019 17:42:19 -0700 (PDT)
Received: from zmx1.isc.org (zmx1.isc.org [149.20.0.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.pao1.isc.org (Postfix) with ESMTPS id 38F393AB007; Fri, 27 Sep 2019 00:42:19 +0000 (UTC)
Received: from zmx1.isc.org (localhost [127.0.0.1]) by zmx1.isc.org (Postfix) with ESMTPS id 17E39160088; Fri, 27 Sep 2019 00:42:19 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1]) by zmx1.isc.org (Postfix) with ESMTP id DB481160087; Fri, 27 Sep 2019 00:42:18 +0000 (UTC)
Received: from zmx1.isc.org ([127.0.0.1]) by localhost (zmx1.isc.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2kca4xKcBuXQ; Fri, 27 Sep 2019 00:42:18 +0000 (UTC)
Received: from [1.0.0.3] (n1-40-244-161.bla1.nsw.optusnet.com.au [1.40.244.161]) by zmx1.isc.org (Postfix) with ESMTPSA id 9F346160047; Fri, 27 Sep 2019 00:42:17 +0000 (UTC)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Mark Andrews <marka@isc.org>
In-Reply-To: <D80EC72D-C8E4-4D4F-999C-C7AC026F3BBA@isc.org>
Date: Fri, 27 Sep 2019 10:42:13 +1000
Cc: dnsop@ietf.org, =?utf-8?B?SmFuIFbEjWVsw6Fr?= <jv@fcelda.cz>
Content-Transfer-Encoding: quoted-printable
Message-Id: <4F3B8925-7D54-4242-B870-98140DAC1F28@isc.org>
References: <d9e82dfe-3298-187d-cc17-a2219b955110@nic.cz> <D80EC72D-C8E4-4D4F-999C-C7AC026F3BBA@isc.org>
To: =?utf-8?B?VmxhZGltw61yIMSMdW7DoXQ=?= <vladimir.cunat+ietf@nic.cz>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/dnsop/JmeyIbDJrprkM7LRMGsQO_91BLM>
Subject: Re: [DNSOP] SVCB and HTTPSSVC records: draft-nygren-dnsop-svcb-httpssvc-00
X-BeenThere: dnsop@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF DNSOP WG mailing list <dnsop.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsop>, <mailto:dnsop-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dnsop/>
List-Post: <mailto:dnsop@ietf.org>
List-Help: <mailto:dnsop-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsop>, <mailto:dnsop-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Sep 2019 00:42:30 -0000

And from an actual implementation.

enum encoding {
        sbpr_text,
        sbpr_port,
        sbpr_ipv4s,
        sbpr_ipv6s,
        sbpr_base64
};

static const struct {
        const char *    name;
        unsigned int    value;
        enum encoding   encoding;
        bool            initial;
} sbpr[] = {
        { "key0=", 0, sbpr_text, true },
        { "alpn=", 1, sbpr_text, true },
        { "port=", 2, sbpr_port, true },
        { "esnikeys=", 3, sbpr_base64, true },
        { "ipv4hint=", 4, sbpr_ipv4s, true },
        { "ipv6hint=", 6, sbpr_ipv6s, true },
};

                switch (sbpr[i].encoding) {
                case sbpr_text:
                        RETERR(multitxt_fromtext(region, target));
                        break;
                case sbpr_port:
                        ul = strtoul(region->base, &e, 10);
                        if (*e != '\0') {
                                return (DNS_R_SYNTAX);
                        }
                        if (ul > 0xffff) {
                                return (ISC_R_RANGE);
                        }
                        RETERR(uint16_tobuffer(ul, target));
                        break;
                case sbpr_ipv4s:
                        do {
                                snprintf(tbuf, sizeof(tbuf), "%*s",
                                         (int)(region->length), region->base);
                                e = strchr(tbuf, ',');
                                if (e != NULL) {
                                        *e++ = 0;
                                        isc_textregion_consume(region,
                                                               e - tbuf);
                                }
                                if (inet_pton(AF_INET, tbuf, abuf) != 1) {
                                        return (DNS_R_SYNTAX);
                                }
                                mem_tobuffer(target, abuf, 4);
                        } while (e != NULL);
                        break;
                case sbpr_ipv6s:
                        do {
                                snprintf(tbuf, sizeof(tbuf), "%*s",
                                         (int)(region->length), region->base);
                                e = strchr(tbuf, ',');
                                if (e != NULL) {
                                        *e++ = 0;
                                        isc_textregion_consume(region,
                                                               e - tbuf);
                                }
                                if (inet_pton(AF_INET6, tbuf, abuf) != 1) {
                                        return (DNS_R_SYNTAX);
                                }
                                mem_tobuffer(target, abuf, 16);
                        } while (e != NULL);
                        break;
                case sbpr_base64:
                        RETERR(isc_base64_decodestring(region->base,
                                                       target));
                        break;
                default:
                        INSIST(0);
                        ISC_UNREACHABLE();
                }


                switch(encoding) {
                case sbpr_text:
                        RETERR(multitxt_totext(&r, target));
                        break;
                case sbpr_port:
                        num = uint16_fromregion(&r);
                        n = snprintf(buf, sizeof(buf), "%u", num);
                        INSIST(n > 0 && (unsigned)n < sizeof(buf));
                        RETERR(str_totext(buf, target));
                        break;
                case sbpr_ipv4s:
                        while (r.length > 0U) {
                                INSIST(r.length >= 4U);
                                inet_ntop(AF_INET, r.base, buf, sizeof(buf));
                                RETERR(str_totext(buf, target));
                                isc_region_consume(&r, 4);
                                if (r.length != 0U) {
                                        RETERR(str_totext(",", target));
                                }
                        }
                        break;
                case sbpr_ipv6s:
                        while (r.length > 0U) {
                                INSIST(r.length >= 16U);
                                inet_ntop(AF_INET6, r.base, buf, sizeof(buf));
                                RETERR(str_totext(buf, target));
                                isc_region_consume(&r, 16);
                                if (r.length != 0U) {
                                        RETERR(str_totext(",", target));
                                }
                        }
                        break;
                case sbpr_base64:
                        RETERR(isc_base64_totext(&r, 0, "", target));
                        break;
                default:
                        INSIST(0);
                        ISC_UNREACHABLE();
                }


> On 27 Sep 2019, at 9:31 am, Mark Andrews <marka@isc.org> wrote:
> 
> Implementing the encoder isn’t hard but it needs to be clearer that there are specific encodings. It is easy to miss this. I did initially.
> 
> -- 
> Mark Andrews
> 
>> On 26 Sep 2019, at 20:41, Vladimír Čunát <vladimir.cunat+ietf@nic.cz> wrote:
>> 
>> 
>> On 9/26/19 12:30 PM, Jan Včelák wrote:
>>>> The current draft attempts to minimize complexity for implementers by offering a fully generic encoding for unknown key types.  For example, "alpn=h3" can also be expressed as "key1=h3", and "port=8003" can also be expressed as "key2=\031\067".  This encoding may not be convenient, but hopefully it will reduce the burden of supporting new parameter types.
>>>> 
>>> I agree we need generic encoding. There is a way to express unknown
>>> record types (
>>> https://tools.ietf.org/html/rfc3597#section-5
>>> ) and the
>>> syntax used there is more compact than what you propose. It uses hex
>>> strings instead of escaped decimal values. However its clumsy to work
>>> with records in that syntax and you proposal is better in that sense.
>>> 
>> I'm curious, Is there much motivation for a bit more compactness of the *presentation* format?  I consider its design primarily meant for humans.
>> 
>> 
>>> I think this may become the most complex record type we have in DNS so
>>> far. None of the existing registered record types contain a list of
>>> key-value pairs of arbitrary length. Given that there is also a
>>> registry for key types involved it will be fun to implement the
>>> encoder/decoder. But we will have to deal with it. I'm interested in
>>> what others in this working group think.
>>> 
>> I think we should get "implementation experience" from multiple parties at least before publishing the RFC (though that's a point far ahead, I suppose).
>> --Vladimir
>> 
>> _______________________________________________
>> DNSOP mailing list
>> DNSOP@ietf.org
>> https://www.ietf.org/mailman/listinfo/dnsop
> _______________________________________________
> DNSOP mailing list
> DNSOP@ietf.org
> https://www.ietf.org/mailman/listinfo/dnsop

-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742              INTERNET: marka@isc.org