[systemd-commits] src/libsystemd src/network src/systemd
Tom Gundersen
tomegun at kemper.freedesktop.org
Thu Aug 14 14:29:46 PDT 2014
src/libsystemd/sd-network/sd-network.c | 4 ++++
src/network/networkd-link.c | 9 +++++++++
src/systemd/sd-network.h | 3 +++
3 files changed, 16 insertions(+)
New commits:
commit 9b4d1882ca46d5b2ae7d028ec2b5d0d0c3a46a76
Author: Tom Gundersen <teg at jklm.no>
Date: Thu Aug 14 20:35:37 2014 +0200
sd-network: add sd_network_linkg_get_domains()
For now this only exposes the domain name (DHCP Option 15), and not
the search string (DHCP Option 119), which will be implemented in
a follow-up patch.
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index 97d041a..4d8b7e7 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -206,6 +206,10 @@ _public_ int sd_network_link_get_ntp(int ifindex, char ***ret) {
return network_get_link_strv("NTP", ifindex, ret);
}
+_public_ int sd_network_link_get_domains(int ifindex, char ***ret) {
+ return network_get_link_strv("DOMAINS", ifindex, ret);
+}
+
static inline int MONITOR_TO_FD(sd_network_monitor *m) {
return (int) (unsigned long) m - 1;
}
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 160f507..6497090 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1763,6 +1763,15 @@ int link_save(Link *link) {
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, "DOMAINS=%s\n", domainname);
+ }
+
fprintf(f, "LLMNR=%s\n",
llmnr_support_to_string(link->network->llmnr));
}
diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h
index 47731c2..db78507 100644
--- a/src/systemd/sd-network.h
+++ b/src/systemd/sd-network.h
@@ -104,6 +104,9 @@ int sd_network_link_get_ntp(int ifindex, char ***addr);
* -ENODATA: networkd is not aware of the link*/
int sd_network_link_get_llmnr(int ifindex, char **llmnr);
+/* Get the DNS domain names for a given link. */
+int sd_network_link_get_domains(int ifindex, char ***domains);
+
/* Monitor object */
typedef struct sd_network_monitor sd_network_monitor;
More information about the systemd-commits
mailing list