1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-27 10:25:06 +03:00

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.
This commit is contained in:
Tom Gundersen 2014-08-14 20:35:37 +02:00
parent 9d685ca819
commit 9b4d1882ca
3 changed files with 16 additions and 0 deletions

View File

@ -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;
}

View File

@ -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));
}

View File

@ -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;