[systemd-devel] [PATCH] networkd: send hostname to dhcp server

Eugene Yakubovich eugene.yakubovich at coreos.com
Tue Jul 1 10:37:00 PDT 2014


>
> > +/* make sure the hostname is not "localhost" */
> > +static bool is_localhost(const char *hostname) {
> > +        char *hostend;
> > +
> > +        assert(hostname);
> > +
> > +        hostend = strchr(hostname, '.');
> > +        if (hostend)
> > +                return strneq(hostname, "localhost", (hostend -
> hostname));
> > +        else
> > +                return streq(hostname, "localhost");
> > +}
>
> We have a similar check in pam_systemd, and in hostnamed. I'd prefer if
> we could unify that and stick it in src/shared/util.[ch]. I am not
> convinced though that check for all names with the "localhost."
> prefix. That appears too broad to me. I'd really just check for
> "localhost" and "localhost.localdomain", where the former is what
> everybody uses, and the latter a redhatism...
>
>
I think in practice localhost and localhost.localdomain should cover it but
there is a
recent RFC 6761 that says this (sec 6.3):

   The domain "localhost." and any names falling within ".localhost."
   are special in the following ways:


... all ways in which localhost is special follows ...

Not sure how much weight this RFC carries and this patch does not follow it
exactly as it should also be checking for somehost.localhost.abc.com

It seemed to me that localhost.mydomain.com should really refer to your
localhost so
that is why I put the check in for that (and also to not special case
localdomain).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140701/31483b82/attachment-0001.html>


More information about the systemd-devel mailing list