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

Lennart Poettering lennart at poettering.net
Wed Aug 13 17:21:14 PDT 2014


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


More information about the systemd-devel mailing list