diff options
author | Tom Gundersen <teg@jklm.no> | 2014-01-18 15:47:57 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-01-18 17:52:10 +0100 |
commit | 039ebe6aebaebcaa18375b33caf1db5fe2551621 (patch) | |
tree | ef0ed8c3ea7d598b3610948df5f64a2a23cc52e6 /src/network/networkd-manager.c | |
parent | bcbca8291fe3beaed36dd672d8b544840cfc49de (diff) |
sd-dhcp-client/networkd: add domainname support
Diffstat (limited to 'src/network/networkd-manager.c')
-rw-r--r-- | src/network/networkd-manager.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index c630ed7ed9..5ab9ba0baf 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -325,6 +325,7 @@ int manager_update_resolv_conf(Manager *m) { Link *link; Iterator i; unsigned count = 0; + const char *domainname = NULL; int r; assert(m); @@ -350,12 +351,20 @@ int manager_update_resolv_conf(Manager *m) { struct in_addr *nameservers; size_t nameservers_size; - r = sd_dhcp_client_get_dns(link->dhcp, &nameservers, &nameservers_size); - if (r >= 0) { - unsigned j; + if (link->network->dhcp_dns) { + r = sd_dhcp_client_get_dns(link->dhcp, &nameservers, &nameservers_size); + if (r >= 0) { + unsigned j; - for (j = 0; j < nameservers_size; j++) - append_dns(f, &nameservers[j], AF_INET, &count); + for (j = 0; j < nameservers_size; j++) + append_dns(f, &nameservers[j], AF_INET, &count); + } + } + + if (link->network->dhcp_domainname && !domainname) { + r = sd_dhcp_client_get_domainname(link->dhcp, &domainname); + if (r >= 0) + fprintf(f, "domain %s\n", domainname); } } } |