]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: also flush /etc/hosts on reload
authorLennart Poettering <lennart@amutable.com>
Wed, 4 Mar 2026 16:08:03 +0000 (17:08 +0100)
committerLennart Poettering <lennart@amutable.com>
Tue, 24 Mar 2026 20:24:47 +0000 (21:24 +0100)
When we are told to reload our configuration also flush out /etc/hosts
explicitly. This is particularly relevant since we suppress too frequent
reloads, and hence a synchronous way to force a reload is very useful.

src/resolve/resolved-etc-hosts.c
src/resolve/resolved-manager.c

index e9100de5229d07d8643562fe40e7d53f5ad98ba8..00c76a9977f85daa1357780c6ab0202bd4e1a379 100644 (file)
@@ -72,6 +72,7 @@ void etc_hosts_clear(EtcHosts *hosts) {
 void manager_etc_hosts_flush(Manager *m) {
         etc_hosts_clear(&m->etc_hosts);
         m->etc_hosts_stat = (struct stat) {};
+        m->etc_hosts_last = USEC_INFINITY;
 }
 
 static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
index a0fb74ec3567ae158b2352084757f4d106191c6d..19ff92bfca5a9fe91a45568d755dc030e6eaffe8 100644 (file)
@@ -659,6 +659,7 @@ static int manager_dispatch_reload_signal(sd_event_source *s, const struct signa
         m->unicast_scope = dns_scope_free(m->unicast_scope);
         m->delegates = hashmap_free(m->delegates);
         dns_trust_anchor_flush(&m->trust_anchor);
+        manager_etc_hosts_flush(m);
 
         manager_set_defaults(m);