2aacef
From 11132a6c20b64eb14a3386ff480086b5bae72146 Mon Sep 17 00:00:00 2001
2aacef
From: Yu Watanabe <watanabe.yu+github@gmail.com>
2aacef
Date: Fri, 4 Nov 2022 12:06:21 +0900
2aacef
Subject: [PATCH] resolve: enable per-link mDNS setting by default
2aacef
2aacef
Otherwise, if the link is not managed by systemd-networkd, mDNS cannot
2aacef
be enabled without calling `resolvectl` explicitly.
2aacef
2aacef
Fixes #25252.
2aacef
2aacef
(cherry picked from commit e31540196b8fb136a8f197c7a26d851bd0b93329)
2aacef
2aacef
Related: #2138081
2aacef
---
2aacef
 src/resolve/resolved-link-bus.c | 2 +-
2aacef
 src/resolve/resolved-link.c     | 8 ++++----
2aacef
 2 files changed, 5 insertions(+), 5 deletions(-)
2aacef
2aacef
diff --git a/src/resolve/resolved-link-bus.c b/src/resolve/resolved-link-bus.c
2aacef
index 1f7d092112..9b6d14f20c 100644
2aacef
--- a/src/resolve/resolved-link-bus.c
2aacef
+++ b/src/resolve/resolved-link-bus.c
2aacef
@@ -562,7 +562,7 @@ int bus_link_method_set_mdns(sd_bus_message *message, void *userdata, sd_bus_err
2aacef
                 return r;
2aacef
 
2aacef
         if (isempty(mdns))
2aacef
-                mode = RESOLVE_SUPPORT_NO;
2aacef
+                mode = RESOLVE_SUPPORT_YES;
2aacef
         else {
2aacef
                 mode = resolve_support_from_string(mdns);
2aacef
                 if (mode < 0)
2aacef
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
2aacef
index 86112f3a3b..d41f6f3e54 100644
2aacef
--- a/src/resolve/resolved-link.c
2aacef
+++ b/src/resolve/resolved-link.c
2aacef
@@ -37,7 +37,7 @@ int link_new(Manager *m, Link **ret, int ifindex) {
2aacef
                 .ifindex = ifindex,
2aacef
                 .default_route = -1,
2aacef
                 .llmnr_support = RESOLVE_SUPPORT_YES,
2aacef
-                .mdns_support = RESOLVE_SUPPORT_NO,
2aacef
+                .mdns_support = RESOLVE_SUPPORT_YES,
2aacef
                 .dnssec_mode = _DNSSEC_MODE_INVALID,
2aacef
                 .dns_over_tls_mode = _DNS_OVER_TLS_MODE_INVALID,
2aacef
                 .operstate = IF_OPER_UNKNOWN,
2aacef
@@ -64,7 +64,7 @@ void link_flush_settings(Link *l) {
2aacef
 
2aacef
         l->default_route = -1;
2aacef
         l->llmnr_support = RESOLVE_SUPPORT_YES;
2aacef
-        l->mdns_support = RESOLVE_SUPPORT_NO;
2aacef
+        l->mdns_support = RESOLVE_SUPPORT_YES;
2aacef
         l->dnssec_mode = _DNSSEC_MODE_INVALID;
2aacef
         l->dns_over_tls_mode = _DNS_OVER_TLS_MODE_INVALID;
2aacef
 
2aacef
@@ -354,7 +354,7 @@ static int link_update_mdns_support(Link *l) {
2aacef
 
2aacef
         assert(l);
2aacef
 
2aacef
-        l->mdns_support = RESOLVE_SUPPORT_NO;
2aacef
+        l->mdns_support = RESOLVE_SUPPORT_YES;
2aacef
 
2aacef
         r = sd_network_link_get_mdns(l->ifindex, &b);
2aacef
         if (r == -ENODATA)
2aacef
@@ -1156,7 +1156,7 @@ static bool link_needs_save(Link *l) {
2aacef
                 return false;
2aacef
 
2aacef
         if (l->llmnr_support != RESOLVE_SUPPORT_YES ||
2aacef
-            l->mdns_support != RESOLVE_SUPPORT_NO ||
2aacef
+            l->mdns_support != RESOLVE_SUPPORT_YES ||
2aacef
             l->dnssec_mode != _DNSSEC_MODE_INVALID ||
2aacef
             l->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID)
2aacef
                 return true;