Are there any limits to the character length of a service nam e in an SRV record?

Corsa, Todd tcorsa at bnl.gov
Tue Aug 31 17:42:19 UTC 2004


I'm refering to the entire "_ldap._tcp.example.com" as a "service name"
because RFC 2782 does so here:

"A reply packet has a 30-byte overhead plus the name
   of the service ("_ldap._tcp.example.com" for instance)"

When I say that it needs to contain a properly formatted domain name, I'm
saying that , by itself, the "example.com" portion has to be a valid domain
name within the domain name space. If not, then the RR is pointless.
Therefore, the service name (or the name of the service if that makes you
more comfortable) must contain a domain name regardless of whether you
consider the entire name of the service a domain name in its own.

I think the problem is exactly that you're trying to say that everything
served by a DNS server is a domain name ("These service
names -- whatever they are -- MUST be domain names in order to be
entered into the DNS.") Take the case of a TXT record. Are you saying that
the text portion of the record has to be a domain name? Do you see where I'm
going with this?

So when I refer to the "example.com" as a domain name, think of it in the
global "IT" sense. It's the name of a domain. Meanwhile
"_ldap._tcp.example.com" is not the name of a domain. It is simply a way to
reference a service available within the domain name space in terms that
adhere as closely to the original DNS standards as possible. Obviously, they
can't possibly conform to the rules laid down in RFC1035 since as per RFC
1035, the underscore is not considered a valid character for names.

Don't get me wrong. I really appreciate your guidance on this, and I'm not
knocking the original RFC (or any of the RFCs for that matter). It's just
that DNS is only a piece of the puzzle in the real world, and it's not the
primary focus of my day to day routine, so what might be clear to a DNS
purist begs a little more clarity for someone who will only be brushing this
topic and then moving on.

As for the answer to my question, your last reply did the trick. Thanks for
your help.

Todd 

-----Original Message-----
From: Jim Reid
To: Corsa, Todd
Cc: bind-users at isc.org
Sent: 8/30/2004 4:55 PM
Subject: Re: Are there any limits to the character length of a service nam e
in an SRV record?

>>>>> "Todd" == Corsa, Todd <tcorsa at bnl.gov> writes:

    Todd> You're right, RFC 1035 could hardly be clearer about limits
    Todd> for domain names, but predates the concept of SRV records,
    Todd> and therefore service names, so I'm looking for clear
    Todd> guidelines.

Presumably your definition of service names means "the set of domain
names that can be assigned to SRV records". If so, these so-called
service names are domain names. They are therefore bound by the
fundamental protocol limits defined in RFC1035 that have already been
quoted to you. All domain names entered into the DNS must follow
RFC1035's rules. That's what makes them domain names. FWIW, RFC2782
suggests a service name is "The symbolic name of the desired service,
as defined in Assigned Numbers....": ie "_smtp", "_ftp", etc.

    Todd> If you're saying that a service name should just be treated
    Todd> like a FQDN, then that would answer my question. So that
    Todd> would mean that "_ldap._tcp.example.com" is a name
    Todd> consisting of 4 labels taking up 24 bytes broken down like
    Todd> this:

    Todd> One octet length field = 1 octet
    Todd> _ldap._tcp.example.com = 22 octets
    Todd> terminating null byte = 1 octet

Nope. Each *label* gets a byte count. Assuming no label compression,
the wire format for the name above would be 5_ldap4_tcp7example3com0.
That's a total of 24 bytes for 4 labels amounting to 19 bytes --
_ldap, _tcp, example & com -- and 5 label byte counts. It's a
convenient accident that your method of counting the length of the
domain name happened to arrive at the right total.

    Todd> So that would mean that a complete service name can contain
    Todd> no more than 253 characters, and that the "_Service" portion
    Todd> can be no more than 63 of the total characters, the "_Proto"
    Todd> portion can be no more than 63 of the total characters, and
    Todd> the "Name" portion must be a properly formatted domain name
    Todd> that can be no longer than 253 minus (_Service length) minus
    Todd> 1 (for the dot after _Service) minus (_Proto length) minus 1
    Todd> ( for the dot after _Proto) characters.

Not quite. Consider the domain name _S._P.F.Q.D.N which is the owner
name for some SRV record. None of the labels -- _S, _P, F, Q, D, N --
can be more than 63 bytes long. The maximum length of _S._P.F.Q.D.N is
255 bytes, including the protocol overhead. However the maximum number
of characters in _S._P.F.Q.D.N (including the dots) can't exceed 253.
One byte is needed for the byte count for the first label: _S. Each
dot in the domain name is replaced by the byte count for each of
the following labels. Another byte is needed for the terminating null
byte. The F.Q.D.N part of the domain name counts towards the overall
maximum length of _S._P.F.Q.D.N. F.Q.D.N can only be as long as:
	255 - (len(_S) +1) - (len(_P) +1) - 2
ie
	255 byte maximum
	- (number of bytes in label _S + 1 byte to encode its length)
	- (number of bytes in label _P + 1 byte to encode its length)
	- 2 for the terminating byte and 1 byte for first label length

You seem to think that the length of a domain name is in addition to
the length of your service names. That's not the case. These service
names -- whatever they are -- MUST be domain names in order to be
entered into the DNS. [Well duh-uh!] Therefore they have to conform to
the rules laid down in RFC1035.


More information about the bind-users mailing list