[systemd-devel] [PATCH] resolved: re-add support for getting local domain from DHCP

Michael Marineau michael.marineau at coreos.com
Thu Aug 14 02:05:47 PDT 2014


On Aug 14, 2014 1:21 AM, "Lennart Poettering" <lennart at poettering.net>
wrote:
>
> On Mon, 04.08.14 10:05, Michael Marineau (michael.marineau at coreos.com)
wrote:
>
> Patch looks pretty good, though I'd really prefer if we could do the
> UseDomain= thing as discussed in the other mail, and not propagate
> DHCP-supplied domain names unless explicitly requested.
>
> This would means we probably mean we'd need two new sd-network.h calls:
>
> int sd_network_get_link_route_domains(int ifindex, char **domains);
> int sd_network_get_link_search_domains(int ifindex, char **domains);
>
> The former would return the list of domains whose requests shall be
> routed to the specified interface, and the latter would be the list of
> domains we actively use for searching single-label domains in.
>
> Any domains configured statically for a link in the .network files would
> be listed in both lists. And depending on the UseDomains= settings the
> dhcp provides domains might be listed on none, both or only one of
> them. or something like that...
>
> >
> >  src/network/networkd-link.c    |  9 +++++++++
> >  src/network/sd-network.c       | 24 ++++++++++++++++++++++++
> >  src/resolve/resolved-link.c    | 20 ++++++++++++++++++++
> >  src/resolve/resolved-link.h    |  2 ++
> >  src/resolve/resolved-manager.c | 10 +++++++++-
> >  src/systemd/sd-network.h       |  3 +++
> >  6 files changed, 67 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
> > index 172be64..42d528f 100644
> > --- a/src/network/networkd-link.c
> > +++ b/src/network/networkd-link.c
> > @@ -2385,6 +2385,15 @@ int link_save(Link *link) {
> >                                  (address + 1 ? " " : ""));
> >
> >                  fputs("\n", f);
> > +
> > +                if (link->network->dhcp_domainname &&
> > +                    link->dhcp_lease) {
> > +                        const char *domainname;
> > +
> > +                        r =
sd_dhcp_lease_get_domainname(link->dhcp_lease, &domainname);
> > +                        if (r >= 0)
> > +                                fprintf(f, "DOMAINNAME=%s\n",
> > domainname);
>
> THis should be plural really, from the beginning. After all the newer
> DHCP specs allow a full list... and we want to allow a full list to be
> provided in the .network files too...
>
> Lennart
>
> --
> Lennart Poettering, Red Hat

Right now the search domains DHCP option is unsupported so it is indeed
singular. Also I had assumed since search domains is both a different DHCP
option and a different resolve.conf option that they would be recorded
separately but I suppose the two options is more of a legacy artifact than
meaningful distinction so it is equally as valid to squash them together
into the search domain list. I am happy to write a follow up patch to
implement the search domains option and support providing additional
domains in the .network file but I think this patch can stand alone since
it fixes a regression.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140814/af16dfa2/attachment-0001.html>


More information about the systemd-devel mailing list