resolved: also flush /etc/hosts on reload

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.
This commit is contained in:
Lennart Poettering
2026-03-24 21:24:47 +01:00
parent 2f1bbebeb9
commit 7ad4411a61
2 changed files with 2 additions and 0 deletions
+1
View 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) {
+1
View 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);