summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-network/sd-network.c4
-rw-r--r--src/network/networkd-link.c9
-rw-r--r--src/systemd/sd-network.h3
3 files changed, 16 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index 97d041ae7f..4d8b7e7b2c 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 160f507dc9..6497090bc0 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 47731c2620..db785077ff 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;