[systemd-devel] [PATCH] network: allow domain names up to 255 characters

Lennart Poettering lennart at poettering.net
Sun Apr 12 09:17:47 PDT 2015


On Sun, 12.04.15 09:02, Shawn Landden (shawnlandden at gmail.com) wrote:

> On Sun, Apr 12, 2015 at 6:35 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Fri, 10.04.15 13:03, Nick Owens (mischief at offblast.org) wrote:
> >
> >> From: mischief <mischief at offblast.org>
> >>
> >> The maximum domain name size is larger than the maximum host name size.
> >> The smaller limit causes valid domains provided by DHCP or .network
> >> files to be silently ignored.
> >
> > Hmm?
> >
> > Can you give an example?
> >
> > What is a domain name according to your definition? And what a
> > hostname?
> >
> > So far, a hostname in my definition was either a single label, or an
> > fqdn, and a domain name the part of the fqdn with the first label
> > removed...
> >
> > With such a definition I am not sure I understand the patch, hence
> > please explain, and give a valid example of where this turns out to be
> > an issue?
> 
> ./x86_64-linux-gnu/bits/posix1_lim.h:#define _POSIX_HOST_NAME_MAX 255
> ./x86_64-linux-gnu/bits/local_lim.h:#define HOST_NAME_MAX 64
> ./x86_64-linux-musl/limits.h:#define HOST_NAME_MAX 255

musl is irrelevant for systemd.

Also, musl is wrong. The Linux kernel maintains the system hostname as
64 char array, and sethostname() enforces that limit.

> Perhaps we need to use _POSIX_HOST_NAME_MAX ?, 

Not really, that' the "minimal accepted value" for
HOST_NAME_MAX and defined to 255. Linux ignores that, and sets
HOST_NAME_MAX to 64 anyway...

> or redefine HOST_NAME_MAX to 255?

No, we will not redefine what the libc provides us with. This can only break.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list