From 5246943e1c27dd7fa8b3af1d1c81c8b473803422 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 22 Jul 2014 18:51:09 -0700 Subject: [PATCH] systemd: re-add support for setting domain name via DHCP --- ...support-for-getting-local-domain-fro.patch | 94 +++++++++++++++++++ ...md-215-r7.ebuild => systemd-215-r8.ebuild} | 0 2 files changed, 94 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/215-0034-resolved-re-add-support-for-getting-local-domain-fro.patch rename sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/{systemd-215-r7.ebuild => systemd-215-r8.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/215-0034-resolved-re-add-support-for-getting-local-domain-fro.patch b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/215-0034-resolved-re-add-support-for-getting-local-domain-fro.patch new file mode 100644 index 0000000000..42e00a78be --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/215-0034-resolved-re-add-support-for-getting-local-domain-fro.patch @@ -0,0 +1,94 @@ +From 9a1aced57aaa6767298667c72308157d849282dc Mon Sep 17 00:00:00 2001 +From: Michael Marineau +Date: Tue, 22 Jul 2014 17:56:40 -0700 +Subject: [PATCH 34/34] resolved: re-add support for getting local domain from + DHCP + +When the code for generating resolv.conf was moved from networkd to +resolved the DHCP domain name code was dropped. +--- + src/network/networkd-link.c | 2 ++ + src/network/sd-network.c | 4 ++++ + src/resolve/resolved-manager.c | 13 +++++++++++++ + src/systemd/sd-network.h | 3 +++ + 4 files changed, 22 insertions(+) + +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index 24b4ebc..f0d48ad 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -2517,9 +2517,11 @@ int link_save(Link *link) { + fprintf(f, + "DHCP_LEASE=%s\n" + "DHCP_USE_DNS=%s\n" ++ "DHCP_USE_DOMAINNAME=%s\n" + "DHCP_USE_NTP=%s\n", + link->lease_file, + yes_no(link->network->dhcp_dns), ++ yes_no(link->network->dhcp_domainname), + yes_no(link->network->dhcp_ntp)); + } else + unlink(link->lease_file); +diff --git a/src/network/sd-network.c b/src/network/sd-network.c +index 3ebc5d8..6ee837e 100644 +--- a/src/network/sd-network.c ++++ b/src/network/sd-network.c +@@ -246,6 +246,10 @@ _public_ int sd_network_dhcp_use_dns(unsigned index) { + return network_get_boolean("DHCP_USE_DNS", index); + } + ++_public_ int sd_network_dhcp_use_domainname(int ifindex) { ++ return network_get_boolean("DHCP_USE_DOMAINNAME", ifindex); ++} ++ + _public_ int sd_network_dhcp_use_ntp(unsigned index) { + return network_get_boolean("DHCP_USE_NTP", index); + } +diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c +index 3ed0603..ddff2aa 100644 +--- a/src/resolve/resolved-manager.c ++++ b/src/resolve/resolved-manager.c +@@ -195,6 +195,7 @@ int manager_update_resolv_conf(Manager *m) { + _cleanup_free_ char *temp_path = NULL; + _cleanup_fclose_ FILE *f = NULL; + _cleanup_free_ unsigned *indices = NULL; ++ const char *domainname = NULL; + Address *address; + unsigned count = 0; + int n, r, i; +@@ -223,6 +224,18 @@ int manager_update_resolv_conf(Manager *m) { + struct in6_addr *nameservers6; + size_t nameservers_size; + ++ if (!domainname) { ++ r = sd_network_dhcp_use_domainname(indices[i]); ++ if (r > 0) { ++ r = sd_network_get_dhcp_lease(indices[i], &lease); ++ if (r >= 0) { ++ r = sd_dhcp_lease_get_domainname(lease, &domainname); ++ if (r >= 0) ++ fprintf(f, "domain %s\n", domainname); ++ } ++ } ++ } ++ + r = sd_network_dhcp_use_dns(indices[i]); + if (r > 0) { + r = sd_network_get_dhcp_lease(indices[i], &lease); +diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h +index 7d05086..3e3ec37 100644 +--- a/src/systemd/sd-network.h ++++ b/src/systemd/sd-network.h +@@ -83,6 +83,9 @@ int sd_network_get_dhcp_lease(unsigned index, sd_dhcp_lease **ret); + /* Returns true if link is configured to respect DNS entries received by DHCP */ + int sd_network_dhcp_use_dns(unsigned index); + ++/* Returns true if link is configured to use the domain name received by DHCP */ ++int sd_network_dhcp_use_domainname(int ifindex); ++ + /* Returns true if link is configured to respect NTP entries received by DHCP */ + int sd_network_dhcp_use_ntp(unsigned index); + +-- +1.8.5.5 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-215-r7.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-215-r8.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-215-r7.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-215-r8.ebuild