diff options
author | Tom Gundersen <teg@jklm.no> | 2014-08-14 20:35:37 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-08-14 23:13:14 +0200 |
commit | 9b4d1882ca46d5b2ae7d028ec2b5d0d0c3a46a76 (patch) | |
tree | d2865779b227a0ca337ed7c23395c2c4cbdab2db /src | |
parent | 9d685ca8193c0da3ad5746be3871f5350179a3b3 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 4 | ||||
-rw-r--r-- | src/network/networkd-link.c | 9 | ||||
-rw-r--r-- | src/systemd/sd-network.h | 3 |
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; |