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

Nick Owens mischief at offblast.org
Sun Apr 12 09:21:18 PDT 2015


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?

if you set the Domains key in the [Network] section of a
systemd.network file to a domain longer than a label, then it will be
ignored. the same is true if your DHCP server sends a domain in option
15 (domain name) that is longer than a label. it will be ignored too.
both of these code paths call 'hostname_is_valid', which will fail if
passed something larger than a label, which a domain name can be.

>
> What is a domain name according to your definition? And what a
> hostname?

rfc 1035 2.3.4. Size limits describes labels as being 63 octets or
less and domain names as 255 octets or less.

>
> 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?

an easy way to reproduce (for me) is to have networkd do dhcp, and
have my dhcp server (dnsmasq) send some domain that is very long
(longer than a label) in option 15. try
"supercalifragilisticexpialidocioussupercalifragilisticexpialidocious",
or the output of `uuidgen`.`uuidgen` as your domain, and networkd will
ignore it because hostname_is_valid won't accept it due to the length.

>
> Lennart
>
> --
> Lennart Poettering, Red Hat


More information about the systemd-devel mailing list