reasonable length of FQDN

Mark Andrews Mark_Andrews at isc.org
Wed Feb 1 12:49:16 UTC 2006


> Mark, isn't that the maximum length of the wire representation of a
> domain name?

	Yes.  All other lengths are derived from that.

> arpa/nameser.h in libbind defines NS_MAXDNAME to be 1025,
> with the comment 'maximum domain name', while NS_MAXCDNAME is defined
> as 255 with the comment 'maximum compressed domain name'. I've always
> wondered where the 1025 came from.

#define DNS_NAME_MAXTEXT 1023
/*%<
 * The maximum length of the text representation of a domain
 * name as generated by dns_name_totext().  This does not
 * include space for a terminating NULL.
 *
 * This definition is conservative - the actual maximum
 * is 1004, derived as follows:
 *  
 *   A backslash-decimal escaped character takes 4 bytes.
 *   A wire-encoded name can be up to 255 bytes and each
 *   label is one length byte + at most 63 bytes of data.
 *   Maximizing the label lengths gives us a name of
 *   three 63-octet labels, one 61-octet label, and the
 *   root label:
 * 
 *      1 + 63 + 1 + 63 + 1 + 63 + 1 + 61 + 1 = 255
 * 
 *   When printed, this is (3 * 63 + 61) * 4
 *   bytes for the escaped label data + 4 bytes for the
 *   dot terminating each label = 1004 bytes total.
 */

#define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
/*%<
 * Suggested size of buffer passed to dns_name_format().
 * Includes space for the terminating NULL.
 */

 
> Also, there's an older post on this list that mentions 1004 as the
> limit, quoting RFC1035 as the source (however, the number is not
> explicitly mentioned in that document):
> 
> http://groups.google.com/group/comp.protocols.dns.bind/browse_thread/thread/6
> 36e8bba1ec6ca0d/c663e6f4b63f95d7?q=FQDN+length&rnum=3#c663e6f4b63f95d7
> 
> On 2/1/06, Mark Andrews <Mark_Andrews at isc.org> wrote:
> > From RFC 1035:
> >
> > To simplify implementations, the total number of octets that represent a
> > domain name (i.e., the sum of all label octets and label lengths) is
> > limited to 255.
> >
> >
> > > TIA~
> > >
> > > --
> > > Roman
> > >
> > >
> > --
> > Mark Andrews, ISC
> > 1 Seymour St., Dundas Valley, NSW 2117, Australia
> > PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org
> >
> >
> >
> 
> 
--
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org



More information about the bind-users mailing list