linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* host name length
@ 2004-03-12 20:16 Ulrich Drepper
  2004-12-04  0:05 ` Randy.Dunlap
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2004-03-12 20:16 UTC (permalink / raw)
  To: Linux Kernel

POSIX nowadays contains

  _POSIX_HOST_NAME_MAX
and
  HOST_NAME_MAX

for programs to use to learn about the maximum host name length which is
allowed.  _POSIX_HOST_NAME_MAX is the standard-required minimum maximum
and the value must be 256.

The problem is that HOST_NAME_MAX currently is defined as 64, as defined
by __NET_UTS_LEN in <linux/utsname.h>.  I.e., we have HOST_NAME_MAX as
smaller than the minimum maximum which is obviously not POSIX compliant.

Now, we can simply ignore the problem or do something about it and
introduce a third version of the utsname structure with sufficiently big
nodename field.

Many OSes used small values before but 256 was chosen as a minimum
maximum and some OSes were changed since host names longer than 64 chars
indeed do exist.  I wonder why this never has been brought to the
attention.  Or were people happy enough with truncated host names?


Anyway, is there interest in getting this changed?

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-03-12 20:16 host name length Ulrich Drepper
@ 2004-12-04  0:05 ` Randy.Dunlap
  2004-12-05 19:47   ` Ulrich Drepper
  2004-12-06  8:35   ` Jan Engelhardt
  0 siblings, 2 replies; 10+ messages in thread
From: Randy.Dunlap @ 2004-12-04  0:05 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: linux-kernel

On Fri, 12 Mar 2004 12:16:38 -0800 Ulrich Drepper wrote:

| POSIX nowadays contains
| 
|   _POSIX_HOST_NAME_MAX
| and
|   HOST_NAME_MAX
| 
| for programs to use to learn about the maximum host name length which is
| allowed.  _POSIX_HOST_NAME_MAX is the standard-required minimum maximum
| and the value must be 256.
| 
| The problem is that HOST_NAME_MAX currently is defined as 64, as defined
| by __NET_UTS_LEN in <linux/utsname.h>.  I.e., we have HOST_NAME_MAX as
| smaller than the minimum maximum which is obviously not POSIX compliant.
| 
| Now, we can simply ignore the problem or do something about it and
| introduce a third version of the utsname structure with sufficiently big
| nodename field.
| 
| Many OSes used small values before but 256 was chosen as a minimum
| maximum and some OSes were changed since host names longer than 64 chars
| indeed do exist.  I wonder why this never has been brought to the
| attention.  Or were people happy enough with truncated host names?
| 
| 
| Anyway, is there interest in getting this changed?

Yes (if not all forgotten).
I was waiting for 2.7, but that seems to be the wrong thing to do.


Can you show/tell me where _POSIX_HOST_NAME_MAX is specified to be
at least 256?  All that I have found so far is SuSv3
[ http://www.unix.org/single_unix_specification/ ], which says for
sys/utsname.h - system name structure:

char  sysname[]  Name of this implementation of the operating system. 
char  nodename[] Name of this node within the communications 
                 network to which this node is attached, if any. 
char  release[]  Current release level of this implementation. 
char  version[]  Current version level of this release. 
char  machine[]  Name of the hardware type on which the system is running. 

The character arrays are of unspecified size, but the data stored in them
shall be terminated by a null byte.
</quote>


and LSB 2.0.1:
[ http://refspecs.freestandards.org/LSB_2.0.1/LSB-Core/LSB-Core.html ]

Maximum length of a host name (not including the terminating null) as returned
from the gethostname function shall be at least 255 bytes.
</quote>

Is there somewhere else to look?
Anyway, I'm willing to do the kernel work if you want help with it.

---
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-04  0:05 ` Randy.Dunlap
@ 2004-12-05 19:47   ` Ulrich Drepper
  2004-12-06  8:35   ` Jan Engelhardt
  1 sibling, 0 replies; 10+ messages in thread
From: Ulrich Drepper @ 2004-12-05 19:47 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Randy.Dunlap wrote:

> Can you show/tell me where _POSIX_HOST_NAME_MAX is specified to be
> at least 256?

XBD, page 255 (in the 2004 edition), <limits.h>

{_POSIX_HOST_NAME_MAX}
  Maximum length of a host name (not including the terminating null) as
  returned from the /gethostname()/ function.
  Value: 255

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBs2Xi2ijCOnn/RHQRAlzqAJ0aGjR6ptG0GfhEK9fK/wh/jHz5FwCgne9q
8CuFUfI27KMdic4+3UDc3mk=
=YoSa
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-04  0:05 ` Randy.Dunlap
  2004-12-05 19:47   ` Ulrich Drepper
@ 2004-12-06  8:35   ` Jan Engelhardt
  2004-12-06 16:45     ` Randy.Dunlap
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2004-12-06  8:35 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Ulrich Drepper, linux-kernel

>| POSIX nowadays contains
>|
>|   _POSIX_HOST_NAME_MAX
>| and
>|   HOST_NAME_MAX
>|
>| for programs to use to learn about the maximum host name length which is
>| allowed.  _POSIX_HOST_NAME_MAX is the standard-required minimum maximum
>| and the value must be 256.
[...]

Please also consider the DNS FAQ. If a (DNS) hostname cannot be longer than X
chars (I don't have the number handy ATM), HOST_NAME_MAX should not be any
greater than X also.



Jan Engelhardt
-- 
ENOSPC

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-06  8:35   ` Jan Engelhardt
@ 2004-12-06 16:45     ` Randy.Dunlap
  2004-12-06 17:31       ` Andreas Steinmetz
  0 siblings, 1 reply; 10+ messages in thread
From: Randy.Dunlap @ 2004-12-06 16:45 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Ulrich Drepper, linux-kernel

Jan Engelhardt wrote:
>>| POSIX nowadays contains
>>|
>>|   _POSIX_HOST_NAME_MAX
>>| and
>>|   HOST_NAME_MAX
>>|
>>| for programs to use to learn about the maximum host name length which is
>>| allowed.  _POSIX_HOST_NAME_MAX is the standard-required minimum maximum
>>| and the value must be 256.
> 
> [...]
> 
> Please also consider the DNS FAQ. If a (DNS) hostname cannot be longer than X
> chars (I don't have the number handy ATM), HOST_NAME_MAX should not be any
> greater than X also.

Hi Jan,
Can you be more specific, please?  about (which) DNS FAQ.
I found several "DNS FAQ"s, but nothing specific about
DNS hostname lengths.

-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-06 16:45     ` Randy.Dunlap
@ 2004-12-06 17:31       ` Andreas Steinmetz
  2004-12-06 19:25         ` Ulrich Drepper
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Steinmetz @ 2004-12-06 17:31 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Jan Engelhardt, Ulrich Drepper, linux-kernel

Randy.Dunlap wrote:
> Hi Jan,
> Can you be more specific, please?  about (which) DNS FAQ.
> I found several "DNS FAQ"s, but nothing specific about
> DNS hostname lengths.
> 

63 characters per label (=hostname) as to:

[RFC1035] Mockapetris, P., "Domain Names - Implementation and 
Specifications", STD 13, RFC 1035, November 1987.

-- 
Andreas Steinmetz                       SPAMmers use robotrap@domdv.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-06 17:31       ` Andreas Steinmetz
@ 2004-12-06 19:25         ` Ulrich Drepper
  2004-12-06 19:28           ` Andreas Steinmetz
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2004-12-06 19:25 UTC (permalink / raw)
  To: Andreas Steinmetz; +Cc: Randy.Dunlap, Jan Engelhardt, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Steinmetz wrote:

> 63 characters per label (=hostname) as to:

A "label" is only a part of the fqdn:

<domain> ::= <subdomain> | " "

<subdomain> ::= <label> | <subdomain> "." <label>

<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]


Yes, each label can only have 63 bytes, but the entire fqdn can be
longer, much longer.  And the hostname stored with sethostname() should
be the fqdn of the machine, not just one lalbel (in DNS speak).

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBtLIQ2ijCOnn/RHQRAiqhAJsH2+QD8oI8O+/tRmg/+uHXlGAAIACdF9D1
qh0Lqh7/OCp20LI34eBPE+I=
=DQ59
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-06 19:25         ` Ulrich Drepper
@ 2004-12-06 19:28           ` Andreas Steinmetz
  2004-12-08 20:29             ` Randy.Dunlap
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Steinmetz @ 2004-12-06 19:28 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Randy.Dunlap, Jan Engelhardt, linux-kernel

Ulrich Drepper wrote:
> Yes, each label can only have 63 bytes, but the entire fqdn can be
> longer, much longer.  And the hostname stored with sethostname() should
> be the fqdn of the machine, not just one lalbel (in DNS speak).

255 characters to be exact. The question was, however, for the hostname 
which I usually don't interpret as a fqdn.
-- 
Andreas Steinmetz                       SPAMmers use robotrap@domdv.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-06 19:28           ` Andreas Steinmetz
@ 2004-12-08 20:29             ` Randy.Dunlap
  2004-12-09  0:35               ` Ulrich Drepper
  0 siblings, 1 reply; 10+ messages in thread
From: Randy.Dunlap @ 2004-12-08 20:29 UTC (permalink / raw)
  To: Andreas Steinmetz; +Cc: Ulrich Drepper, Jan Engelhardt, linux-kernel

Andreas Steinmetz wrote:
> Ulrich Drepper wrote:
> 
>> Yes, each label can only have 63 bytes, but the entire fqdn can be
>> longer, much longer.  And the hostname stored with sethostname() should
>> be the fqdn of the machine, not just one lalbel (in DNS speak).
> 
> 
> 255 characters to be exact. The question was, however, for the hostname 
> which I usually don't interpret as a fqdn.

So sethostname(2) sets fqdn, right?

Ulrich, do you want help on this or is it already done?

-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: host name length
  2004-12-08 20:29             ` Randy.Dunlap
@ 2004-12-09  0:35               ` Ulrich Drepper
  0 siblings, 0 replies; 10+ messages in thread
From: Ulrich Drepper @ 2004-12-09  0:35 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Andreas Steinmetz, Jan Engelhardt, linux-kernel


> So sethostname(2) sets fqdn, right?

It depends on what people want.  Some people want to use the fqdn.


> Ulrich, do you want help on this or is it already done?

I haven't done any owkr on it an unlikely will get to it anytime soon.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-12-09  0:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12 20:16 host name length Ulrich Drepper
2004-12-04  0:05 ` Randy.Dunlap
2004-12-05 19:47   ` Ulrich Drepper
2004-12-06  8:35   ` Jan Engelhardt
2004-12-06 16:45     ` Randy.Dunlap
2004-12-06 17:31       ` Andreas Steinmetz
2004-12-06 19:25         ` Ulrich Drepper
2004-12-06 19:28           ` Andreas Steinmetz
2004-12-08 20:29             ` Randy.Dunlap
2004-12-09  0:35               ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).