summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-01-05 17:32:25 +0100
committerLennart Poettering <lennart@poettering.net>2016-01-05 17:41:41 +0100
commitaaa297d4e5401fd4466632555432774863457f1d (patch)
treefba0368e1037d4cd02760fce8dc6450d819de72b /src
parentaf49ca27ffd790d78dbbb465b978266dfd5c93da (diff)
networkd,resolved: add a per-interface mdns configuration option
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-network/sd-network.c4
-rw-r--r--src/network/networkd-link.c2
-rw-r--r--src/network/networkd-network-gperf.gperf1
-rw-r--r--src/network/networkd-network.c1
-rw-r--r--src/network/networkd-network.h1
-rw-r--r--src/resolve/resolved-link.c28
-rw-r--r--src/systemd/sd-network.h7
7 files changed, 44 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index d01c4ae8e2..a63ff46c68 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -139,6 +139,10 @@ _public_ int sd_network_link_get_llmnr(int ifindex, char **llmnr) {
return network_link_get_string(ifindex, "LLMNR", llmnr);
}
+_public_ int sd_network_link_get_mdns(int ifindex, char **mdns) {
+ return network_link_get_string(ifindex, "MDNS", mdns);
+}
+
_public_ int sd_network_link_get_lldp(int ifindex, char **lldp) {
_cleanup_free_ char *s = NULL, *p = NULL;
size_t size;
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 9811526c6d..2013a8eae7 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2868,6 +2868,8 @@ int link_save(Link *link) {
fprintf(f, "LLMNR=%s\n",
resolve_support_to_string(link->network->llmnr));
+ fprintf(f, "MDNS=%s\n",
+ resolve_support_to_string(link->network->mdns));
fputs("ADDRESSES=", f);
space = false;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 5c962e5709..c66ca3c1cc 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -46,6 +46,7 @@ Network.Gateway, config_parse_gateway,
Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
Network.LLMNR, config_parse_resolve_support, 0, offsetof(Network, llmnr)
+Network.MulticastDNS, config_parse_resolve_support, 0, offsetof(Network, mdns)
Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
Network.IPForward, config_parse_address_family_boolean_with_kernel,0, offsetof(Network, ip_forward)
Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 29723a852f..7544280a7a 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -121,6 +121,7 @@ static int network_load_one(Manager *manager, const char *filename) {
network->unicast_flood = true;
network->llmnr = RESOLVE_SUPPORT_YES;
+ network->mdns = RESOLVE_SUPPORT_NO;
network->link_local = ADDRESS_FAMILY_IPV6;
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index 297823da24..91e90e6d74 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -145,6 +145,7 @@ struct Network {
char **domains, **dns, **ntp, **bind_carrier;
ResolveSupport llmnr;
+ ResolveSupport mdns;
LIST_FIELDS(Network, networks);
};
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 6202ddeca1..a1f28633ba 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -246,6 +246,33 @@ clear:
return r;
}
+static int link_update_mdns_support(Link *l) {
+ _cleanup_free_ char *b = NULL;
+ int r;
+
+ assert(l);
+
+ r = sd_network_link_get_mdns(l->ifindex, &b);
+ if (r == -ENODATA) {
+ r = 0;
+ goto clear;
+ }
+ if (r < 0)
+ goto clear;
+
+ l->mdns_support = resolve_support_from_string(b);
+ if (l->mdns_support < 0) {
+ r = -EINVAL;
+ goto clear;
+ }
+
+ return 0;
+
+clear:
+ l->mdns_support = RESOLVE_SUPPORT_NO;
+ return r;
+}
+
static int link_update_search_domains(Link *l) {
_cleanup_strv_free_ char **domains = NULL;
char **i;
@@ -295,6 +322,7 @@ int link_update_monitor(Link *l) {
link_update_dns_servers(l);
link_update_llmnr_support(l);
+ link_update_mdns_support(l);
link_allocate_scopes(l);
r = link_update_search_domains(l);
diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h
index 79b4bf9ea3..6765be041b 100644
--- a/src/systemd/sd-network.h
+++ b/src/systemd/sd-network.h
@@ -111,6 +111,13 @@ int sd_network_link_get_ntp(int ifindex, char ***addr);
*/
int sd_network_link_get_llmnr(int ifindex, char **llmnr);
+/* Indicates whether or not MDNS should be enabled for the link
+ * Possible levels of support: yes, no, resolve
+ * Possible return codes:
+ * -ENODATA: networkd is not aware of the link
+ */
+int sd_network_link_get_mdns(int ifindex, char **mdns);
+
int sd_network_link_get_lldp(int ifindex, char **lldp);
/* Get the DNS domain names for a given link. */