names, network: Re-feed DNS known to network-manager to resolved

- This avoids using fallback DNS servers in systemd-resolved soon after
systemd-resolved takes over /etc/resolv.conf and if network-manager knows some
DNS servers from the connections it has established.

- Version for the names app has already been incremented in this patch series.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2024-09-04 10:30:00 +03:00
1 parent 0817e7af45
commit 28886b56cf
2 files changed
+15 -1

No files matched your search

+10 -1
View File
@@ -8,7 +8,7 @@ import logging
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, menu
from plinth import cfg, menu, network
from plinth.daemon import Daemon
from plinth.modules.backups.components import BackupRestore
from plinth.package import Packages
@@ -82,6 +82,15 @@ class NamesApp(app_module.App):
# FreedomBox.
service_privileged.restart('systemd-resolved')
# After systemd-resolved is freshly installed, /etc/resolve.conf
# becomes a symlink to configuration pointing to systemd-resovled stub
# resolver. However, the old contents are not fed from network-manager
# (if it was present earlier and wrote to /etc/resolve.conf). Ask
# network-manager to feed the DNS servers from the connections it has
# established to systemd-resolved so that using fallback DNS servers is
# not necessary.
network.refeed_dns()
self.enable()