Re: [DNSOP] Clarification question: compression pointers always to names earlier in the packet?

Shane Kerr <> Wed, 24 October 2018 20:25 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 75163130DFB for <>; Wed, 24 Oct 2018 13:25:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id Ei9HkrLmz54V for <>; Wed, 24 Oct 2018 13:25:15 -0700 (PDT)
Received: from ( [IPv6:2a02:2770::21a:4aff:fea3:eeaa]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 54F7A128D68 for <>; Wed, 24 Oct 2018 13:25:15 -0700 (PDT)
Received: from [2001:470:78c8:2:74eb:e519:2d30:7b79] by with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <>) id 1gFPiU-0006gv-Dj for; Wed, 24 Oct 2018 20:25:22 +0000
References: <> <>
From: Shane Kerr <>
Message-ID: <>
Date: Wed, 24 Oct 2018 22:25:12 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1
MIME-Version: 1.0
In-Reply-To: <>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <>
Subject: Re: [DNSOP] Clarification question: compression pointers always to names earlier in the packet?
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF DNSOP WG mailing list <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 24 Oct 2018 20:25:18 -0000


On 24/10/2018 15.38, John Dickinson wrote:
> On 24 Oct 2018, at 10:01, Viktor Dukhovni wrote:
>> My reading of RFC 1035 is that DNS name "compression"
>> via "pointers" is restricted to name strictly earlier
>> in the DNS message:
>>    4.1.4. Message compression
>>    In order to reduce the size of messages, the domain system utilizes a
>>    compression scheme which eliminates the repetition of domain names 
>> in a
>>    message.  In this scheme, an entire domain name or a list of labels at
>>    the end of a domain name is replaced with a pointer to a prior 
>> occurance
>> ---------------
>>    of the same name.
> Not strictly to do with loops but we noticed that not all nameservers 
> use the same compression algorithm. See section 9.1 and appendix B of 

It's not too surprising. I am pretty sure that producing optimal name 
compression (by size) is the same as one of packing problems, which are 
either NP-complete or NP-hard depending on the particulars:

I think that this is only true if you allow re-ordering of RRset as well 
as RR within a set, but still.

If you don't allow re-ordering then I think the overall complexity of 
compressing a message is the same as sorting, O(NlgN), which while a lot 
better is still not great, because you need to search through all prior 
labels to find the longest match when compressing each name.

I think it's due to these fundamentally expensive costs that different 
name servers use the various heuristics you mention in the C-DNS draft 
to try to get a good balance of speed & size.