mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
networkd,resolved: add a per-interface mdns configuration option
This commit is contained in:
parent
af49ca27ff
commit
aaa297d4e5
@ -277,10 +277,27 @@
|
||||
<varlistentry>
|
||||
<term><varname>LLMNR=</varname></term>
|
||||
<listitem>
|
||||
<para>A boolean or <literal>resolve</literal>. When true, enables
|
||||
Link-Local Multicast Name Resolution on the link. When set to
|
||||
<literal>resolve</literal>, only resolution is enabled, but not
|
||||
announcement. Defaults to true.</para>
|
||||
<para>A boolean or <literal>resolve</literal>. When true,
|
||||
enables <ulink
|
||||
url="https://tools.ietf.org/html/rfc4795">Link-Local
|
||||
Multicast Name Resolution</ulink> on the link. When set to
|
||||
<literal>resolve</literal>, only resolution is enabled,
|
||||
but not host registration and announcement. Defaults to
|
||||
true. This setting is read by
|
||||
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>MulticastDNS=</varname></term>
|
||||
<listitem>
|
||||
<para>A boolean or <literal>resolve</literal>. When true,
|
||||
enables <ulink
|
||||
url="https://tools.ietf.org/html/rfc6762">Multicast
|
||||
DNS</ulink> support on the link. When set to
|
||||
<literal>resolve</literal>, only resolution is enabled,
|
||||
but not host or service registration and
|
||||
announcement. Defaults to false. This setting is read by
|
||||
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -1013,7 +1030,8 @@ DHCP=yes
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -145,6 +145,7 @@ struct Network {
|
||||
char **domains, **dns, **ntp, **bind_carrier;
|
||||
|
||||
ResolveSupport llmnr;
|
||||
ResolveSupport mdns;
|
||||
|
||||
LIST_FIELDS(Network, networks);
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user