1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

resolved: emit change for LLMNRHostname

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-10-25 16:29:42 +02:00
parent 5f3340ca5b
commit 86c0411ee5
2 changed files with 6 additions and 2 deletions

View File

@ -1835,7 +1835,7 @@ static int bus_method_unregister_service(sd_bus_message *message, void *userdata
static const sd_bus_vtable resolve_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), 0),
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("LLMNR", "s", bus_property_get_resolve_support, offsetof(Manager, llmnr_support), 0),
SD_BUS_PROPERTY("MulticastDNS", "s", bus_property_get_resolve_support, offsetof(Manager, mdns_support), 0),
SD_BUS_PROPERTY("DNSOverTLS", "s", bus_property_get_dns_over_tls_mode, 0, 0),

View File

@ -438,6 +438,7 @@ static int make_fallback_hostnames(char **full_hostname, char **llmnr_hostname,
static int on_hostname_change(sd_event_source *es, int fd, uint32_t revents, void *userdata) {
_cleanup_free_ char *full_hostname = NULL, *llmnr_hostname = NULL, *mdns_hostname = NULL;
Manager *m = userdata;
bool llmnr_hostname_changed;
int r;
assert(m);
@ -446,8 +447,9 @@ static int on_hostname_change(sd_event_source *es, int fd, uint32_t revents, voi
if (r < 0)
return 0; /* ignore invalid hostnames */
llmnr_hostname_changed = !streq(llmnr_hostname, m->llmnr_hostname);
if (streq(full_hostname, m->full_hostname) &&
streq(llmnr_hostname, m->llmnr_hostname) &&
!llmnr_hostname_changed &&
streq(mdns_hostname, m->mdns_hostname))
return 0;
@ -458,6 +460,7 @@ static int on_hostname_change(sd_event_source *es, int fd, uint32_t revents, voi
free_and_replace(m->mdns_hostname, mdns_hostname);
manager_refresh_rrs(m);
(void) manager_send_changed(m, "LLMNRHostname");
return 0;
}
@ -1173,6 +1176,7 @@ int manager_next_hostname(Manager *m) {
free_and_replace(m->mdns_hostname, k);
manager_refresh_rrs(m);
(void) manager_send_changed(m, "LLMNRHostname");
return 0;
}