resolve: Rename 'DnssdService', update all dependent code components
Prepare for upcoming mDNS browse services. Distinguish between registered and discovered services to avoid confusion. Co-authored-by: Vishwanath Chandapur <vishwanath.chandapur@philips.com>
This commit is contained in:
co-authored by
Vishwanath Chandapur
parent
6488fa5634
commit
108bd5c297
+11
-11
@@ -1847,24 +1847,24 @@ static int bus_method_reset_server_features(sd_bus_message *message, void *userd
|
||||
return sd_bus_reply_method_return(message, NULL);
|
||||
}
|
||||
|
||||
static int dnssd_service_on_bus_track(sd_bus_track *t, void *userdata) {
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
static int dnssd_registered_service_on_bus_track(sd_bus_track *t, void *userdata) {
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
|
||||
assert(t);
|
||||
|
||||
log_debug("Client of active request vanished, destroying DNS-SD service.");
|
||||
dnssd_service_free(s);
|
||||
dnssd_registered_service_free(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bus_method_register_service(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
|
||||
_cleanup_(dnssd_service_freep) DnssdService *service = NULL;
|
||||
_cleanup_(dnssd_registered_service_freep) DnssdRegisteredService *service = NULL;
|
||||
_cleanup_(sd_bus_track_unrefp) sd_bus_track *bus_track = NULL;
|
||||
const char *id, *name_template, *type;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
DnssdService *s = NULL;
|
||||
DnssdRegisteredService *s = NULL;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
uid_t euid;
|
||||
int r;
|
||||
@@ -1874,7 +1874,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
|
||||
if (m->mdns_support != RESOLVE_SUPPORT_YES)
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Support for MulticastDNS is disabled");
|
||||
|
||||
service = new0(DnssdService, 1);
|
||||
service = new0(DnssdRegisteredService, 1);
|
||||
if (!service)
|
||||
return log_oom();
|
||||
|
||||
@@ -1900,7 +1900,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
|
||||
if (!dnssd_srv_type_is_valid(type))
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "DNS-SD service type '%s' is invalid", type);
|
||||
|
||||
s = hashmap_get(m->dnssd_services, id);
|
||||
s = hashmap_get(m->dnssd_registered_services, id);
|
||||
if (s)
|
||||
return sd_bus_error_setf(error, BUS_ERROR_DNSSD_SERVICE_EXISTS, "DNS-SD service '%s' exists already", id);
|
||||
|
||||
@@ -2013,11 +2013,11 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
|
||||
if (r == 0)
|
||||
return 1; /* Polkit will call us back */
|
||||
|
||||
r = hashmap_ensure_put(&m->dnssd_services, &string_hash_ops, service->id, service);
|
||||
r = hashmap_ensure_put(&m->dnssd_registered_services, &string_hash_ops, service->id, service);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sd_bus_track_new(sd_bus_message_get_bus(message), &bus_track, dnssd_service_on_bus_track, service);
|
||||
r = sd_bus_track_new(sd_bus_message_get_bus(message), &bus_track, dnssd_registered_service_on_bus_track, service);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -2036,7 +2036,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
|
||||
|
||||
static int call_dnssd_method(Manager *m, sd_bus_message *message, sd_bus_message_handler_t handler, sd_bus_error *error) {
|
||||
_cleanup_free_ char *name = NULL;
|
||||
DnssdService *s = NULL;
|
||||
DnssdRegisteredService *s = NULL;
|
||||
const char *path;
|
||||
int r;
|
||||
|
||||
@@ -2054,7 +2054,7 @@ static int call_dnssd_method(Manager *m, sd_bus_message *message, sd_bus_message
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
s = hashmap_get(m->dnssd_services, name);
|
||||
s = hashmap_get(m->dnssd_registered_services, name);
|
||||
if (!s)
|
||||
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_DNSSD_SERVICE, "DNS-SD service '%s' not known", name);
|
||||
|
||||
|
||||
@@ -1652,18 +1652,18 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dns_scope_add_dnssd_services(DnsScope *scope) {
|
||||
DnssdService *service;
|
||||
int dns_scope_add_dnssd_registered_services(DnsScope *scope) {
|
||||
DnssdRegisteredService *service;
|
||||
int r;
|
||||
|
||||
assert(scope);
|
||||
|
||||
if (hashmap_isempty(scope->manager->dnssd_services))
|
||||
if (hashmap_isempty(scope->manager->dnssd_registered_services))
|
||||
return 0;
|
||||
|
||||
scope->announced = false;
|
||||
|
||||
HASHMAP_FOREACH(service, scope->manager->dnssd_services) {
|
||||
HASHMAP_FOREACH(service, scope->manager->dnssd_registered_services) {
|
||||
service->withdrawn = false;
|
||||
|
||||
r = dns_zone_put(&scope->zone, scope, service->ptr_rr, false);
|
||||
@@ -1690,9 +1690,9 @@ int dns_scope_add_dnssd_services(DnsScope *scope) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dns_scope_remove_dnssd_services(DnsScope *scope) {
|
||||
int dns_scope_remove_dnssd_registered_services(DnsScope *scope) {
|
||||
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
|
||||
DnssdService *service;
|
||||
DnssdRegisteredService *service;
|
||||
int r;
|
||||
|
||||
assert(scope);
|
||||
@@ -1706,7 +1706,7 @@ int dns_scope_remove_dnssd_services(DnsScope *scope) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
HASHMAP_FOREACH(service, scope->manager->dnssd_services) {
|
||||
HASHMAP_FOREACH(service, scope->manager->dnssd_registered_services) {
|
||||
dns_zone_remove_rr(&scope->zone, service->ptr_rr);
|
||||
dns_zone_remove_rr(&scope->zone, service->sub_ptr_rr);
|
||||
dns_zone_remove_rr(&scope->zone, service->srv_rr);
|
||||
|
||||
@@ -116,8 +116,8 @@ const char* dns_scope_ifname(DnsScope *s);
|
||||
|
||||
int dns_scope_announce(DnsScope *scope, bool goodbye);
|
||||
|
||||
int dns_scope_add_dnssd_services(DnsScope *scope);
|
||||
int dns_scope_remove_dnssd_services(DnsScope *scope);
|
||||
int dns_scope_add_dnssd_registered_services(DnsScope *scope);
|
||||
int dns_scope_remove_dnssd_registered_services(DnsScope *scope);
|
||||
|
||||
bool dns_scope_is_default_route(DnsScope *scope);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "strv.h"
|
||||
|
||||
int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
Manager *m;
|
||||
Link *l;
|
||||
int r;
|
||||
@@ -63,7 +63,7 @@ int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_
|
||||
}
|
||||
}
|
||||
|
||||
dnssd_service_free(s);
|
||||
dnssd_registered_service_free(s);
|
||||
|
||||
manager_refresh_rrs(m);
|
||||
|
||||
@@ -73,7 +73,7 @@ int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_
|
||||
static int dnssd_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) {
|
||||
_cleanup_free_ char *name = NULL;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
DnssdService *service;
|
||||
DnssdRegisteredService *service;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@@ -85,7 +85,7 @@ static int dnssd_object_find(sd_bus *bus, const char *path, const char *interfac
|
||||
if (r <= 0)
|
||||
return 0;
|
||||
|
||||
service = hashmap_get(m->dnssd_services, name);
|
||||
service = hashmap_get(m->dnssd_registered_services, name);
|
||||
if (!service)
|
||||
return 0;
|
||||
|
||||
@@ -96,7 +96,7 @@ static int dnssd_object_find(sd_bus *bus, const char *path, const char *interfac
|
||||
static int dnssd_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) {
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
DnssdService *service;
|
||||
DnssdRegisteredService *service;
|
||||
unsigned c = 0;
|
||||
int r;
|
||||
|
||||
@@ -104,11 +104,11 @@ static int dnssd_node_enumerator(sd_bus *bus, const char *path, void *userdata,
|
||||
assert(path);
|
||||
assert(nodes);
|
||||
|
||||
l = new0(char*, hashmap_size(m->dnssd_services) + 1);
|
||||
l = new0(char*, hashmap_size(m->dnssd_registered_services) + 1);
|
||||
if (!l)
|
||||
return -ENOMEM;
|
||||
|
||||
HASHMAP_FOREACH(service, m->dnssd_services) {
|
||||
HASHMAP_FOREACH(service, m->dnssd_registered_services) {
|
||||
char *p;
|
||||
|
||||
r = sd_bus_path_encode("/org/freedesktop/resolve1/dnssd", service->id, &p);
|
||||
|
||||
@@ -18,11 +18,11 @@ struct ConfigPerfItem;
|
||||
%struct-type
|
||||
%includes
|
||||
%%
|
||||
Service.Name, config_parse_dnssd_service_name, 0, 0
|
||||
Service.Type, config_parse_dnssd_service_type, 0, 0
|
||||
Service.SubType, config_parse_dnssd_service_subtype, 0, 0
|
||||
Service.Port, config_parse_ip_port, 0, offsetof(DnssdService, port)
|
||||
Service.Priority, config_parse_uint16, 0, offsetof(DnssdService, priority)
|
||||
Service.Weight, config_parse_uint16, 0, offsetof(DnssdService, weight)
|
||||
Service.Name, config_parse_dnssd_registered_service_name, 0, 0
|
||||
Service.Type, config_parse_dnssd_registered_service_type, 0, 0
|
||||
Service.SubType, config_parse_dnssd_registered_service_subtype, 0, 0
|
||||
Service.Port, config_parse_ip_port, 0, offsetof(DnssdRegisteredService, port)
|
||||
Service.Priority, config_parse_uint16, 0, offsetof(DnssdRegisteredService, priority)
|
||||
Service.Weight, config_parse_uint16, 0, offsetof(DnssdRegisteredService, weight)
|
||||
Service.TxtText, config_parse_dnssd_txt, DNS_TXT_ITEM_TEXT, 0
|
||||
Service.TxtData, config_parse_dnssd_txt, DNS_TXT_ITEM_DATA, 0
|
||||
|
||||
@@ -46,12 +46,12 @@ DnssdTxtData *dnssd_txtdata_free_all(DnssdTxtData *txt_data) {
|
||||
return dnssd_txtdata_free_all(next);
|
||||
}
|
||||
|
||||
DnssdService *dnssd_service_free(DnssdService *service) {
|
||||
DnssdRegisteredService *dnssd_registered_service_free(DnssdRegisteredService *service) {
|
||||
if (!service)
|
||||
return NULL;
|
||||
|
||||
if (service->manager)
|
||||
hashmap_remove(service->manager->dnssd_services, service->id);
|
||||
hashmap_remove(service->manager->dnssd_registered_services, service->id);
|
||||
|
||||
dns_resource_record_unref(service->ptr_rr);
|
||||
dns_resource_record_unref(service->sub_ptr_rr);
|
||||
@@ -68,13 +68,13 @@ DnssdService *dnssd_service_free(DnssdService *service) {
|
||||
return mfree(service);
|
||||
}
|
||||
|
||||
void dnssd_service_clear_on_reload(Hashmap *services) {
|
||||
DnssdService *service;
|
||||
void dnssd_registered_service_clear_on_reload(Hashmap *services) {
|
||||
DnssdRegisteredService *service;
|
||||
|
||||
HASHMAP_FOREACH(service, services)
|
||||
if (service->config_source == RESOLVE_CONFIG_SOURCE_FILE) {
|
||||
hashmap_remove(services, service->id);
|
||||
dnssd_service_free(service);
|
||||
dnssd_registered_service_free(service);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ static int dnssd_id_from_path(const char *path, char **ret_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dnssd_service_load(Manager *manager, const char *path) {
|
||||
_cleanup_(dnssd_service_freep) DnssdService *service = NULL;
|
||||
static int dnssd_registered_service_load(Manager *manager, const char *path) {
|
||||
_cleanup_(dnssd_registered_service_freep) DnssdRegisteredService *service = NULL;
|
||||
_cleanup_(dnssd_txtdata_freep) DnssdTxtData *txt_data = NULL;
|
||||
_cleanup_free_ char *dropin_dirname = NULL;
|
||||
int r;
|
||||
@@ -108,7 +108,7 @@ static int dnssd_service_load(Manager *manager, const char *path) {
|
||||
assert(manager);
|
||||
assert(path);
|
||||
|
||||
service = new0(DnssdService, 1);
|
||||
service = new0(DnssdRegisteredService, 1);
|
||||
if (!service)
|
||||
return log_oom();
|
||||
|
||||
@@ -158,7 +158,7 @@ static int dnssd_service_load(Manager *manager, const char *path) {
|
||||
TAKE_PTR(txt_data);
|
||||
}
|
||||
|
||||
r = hashmap_ensure_put(&manager->dnssd_services, &string_hash_ops, service->id, service);
|
||||
r = hashmap_ensure_put(&manager->dnssd_registered_services, &string_hash_ops, service->id, service);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -181,7 +181,7 @@ static int specifier_dnssd_hostname(char specifier, const void *data, const char
|
||||
return strdup_to(ret, m->llmnr_hostname);
|
||||
}
|
||||
|
||||
int dnssd_render_instance_name(Manager *m, DnssdService *s, char **ret) {
|
||||
int dnssd_render_instance_name(Manager *m, DnssdRegisteredService *s, char **ret) {
|
||||
static const Specifier specifier_table[] = {
|
||||
{ 'a', specifier_architecture, NULL },
|
||||
{ 'b', specifier_boot_id, NULL },
|
||||
@@ -230,7 +230,7 @@ int dnssd_load(Manager *manager) {
|
||||
return log_error_errno(r, "Failed to enumerate .dnssd files: %m");
|
||||
|
||||
STRV_FOREACH_BACKWARDS(f, files) {
|
||||
r = dnssd_service_load(manager, *f);
|
||||
r = dnssd_registered_service_load(manager, *f);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to load '%s': %m", *f);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ int dnssd_load(Manager *manager) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dnssd_update_rrs(DnssdService *s) {
|
||||
int dnssd_update_rrs(DnssdRegisteredService *s) {
|
||||
_cleanup_free_ char *n = NULL, *service_name = NULL, *full_name = NULL, *sub_name = NULL, *selective_name = NULL;
|
||||
int r;
|
||||
|
||||
@@ -379,13 +379,13 @@ int dnssd_txt_item_new_from_data(const char *key, const void *data, const size_t
|
||||
}
|
||||
|
||||
int dnssd_signal_conflict(Manager *manager, const char *name) {
|
||||
DnssdService *s;
|
||||
DnssdRegisteredService *s;
|
||||
int r;
|
||||
|
||||
if (sd_bus_is_ready(manager->bus) <= 0)
|
||||
return 0;
|
||||
|
||||
HASHMAP_FOREACH(s, manager->dnssd_services) {
|
||||
HASHMAP_FOREACH(s, manager->dnssd_registered_services) {
|
||||
if (s->withdrawn)
|
||||
continue;
|
||||
|
||||
@@ -413,7 +413,7 @@ int dnssd_signal_conflict(Manager *manager, const char *name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_dnssd_service_name(
|
||||
int config_parse_dnssd_registered_service_name(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
@@ -437,7 +437,7 @@ int config_parse_dnssd_service_name(
|
||||
{ 'W', specifier_os_variant_id, NULL },
|
||||
{}
|
||||
};
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
_cleanup_free_ char *name = NULL;
|
||||
int r;
|
||||
|
||||
@@ -467,7 +467,7 @@ int config_parse_dnssd_service_name(
|
||||
return free_and_strdup_warn(&s->name_template, rvalue);
|
||||
}
|
||||
|
||||
int config_parse_dnssd_service_type(
|
||||
int config_parse_dnssd_registered_service_type(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
@@ -479,7 +479,7 @@ int config_parse_dnssd_service_type(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
@@ -503,7 +503,7 @@ int config_parse_dnssd_service_type(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_dnssd_service_subtype(
|
||||
int config_parse_dnssd_registered_service_subtype(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
@@ -515,7 +515,7 @@ int config_parse_dnssd_service_subtype(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
@@ -547,7 +547,7 @@ int config_parse_dnssd_txt(
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(dnssd_txtdata_freep) DnssdTxtData *txt_data = NULL;
|
||||
DnssdService *s = ASSERT_PTR(userdata);
|
||||
DnssdRegisteredService *s = ASSERT_PTR(userdata);
|
||||
DnsTxtItem *last = NULL;
|
||||
|
||||
assert(filename);
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef struct DnssdTxtData {
|
||||
LIST_FIELDS(DnssdTxtData, items);
|
||||
} DnssdTxtData;
|
||||
|
||||
typedef struct DnssdService {
|
||||
typedef struct DnssdRegisteredService {
|
||||
char *path;
|
||||
char *id;
|
||||
char *name_template;
|
||||
@@ -44,26 +44,26 @@ typedef struct DnssdService {
|
||||
|
||||
bool withdrawn:1;
|
||||
uid_t originator;
|
||||
} DnssdService;
|
||||
} DnssdRegisteredService;
|
||||
|
||||
DnssdService *dnssd_service_free(DnssdService *service);
|
||||
DnssdRegisteredService *dnssd_registered_service_free(DnssdRegisteredService *service);
|
||||
DnssdTxtData *dnssd_txtdata_free(DnssdTxtData *txt_data);
|
||||
DnssdTxtData *dnssd_txtdata_free_all(DnssdTxtData *txt_data);
|
||||
void dnssd_service_clear_on_reload(Hashmap *services);
|
||||
void dnssd_registered_service_clear_on_reload(Hashmap *services);
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(DnssdService*, dnssd_service_free);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(DnssdRegisteredService*, dnssd_registered_service_free);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(DnssdTxtData*, dnssd_txtdata_free);
|
||||
|
||||
int dnssd_render_instance_name(Manager *m, DnssdService *s, char **ret);
|
||||
int dnssd_render_instance_name(Manager *m, DnssdRegisteredService *s, char **ret);
|
||||
int dnssd_load(Manager *manager);
|
||||
int dnssd_txt_item_new_from_string(const char *key, const char *value, DnsTxtItem **ret_item);
|
||||
int dnssd_txt_item_new_from_data(const char *key, const void *value, const size_t size, DnsTxtItem **ret_item);
|
||||
int dnssd_update_rrs(DnssdService *s);
|
||||
int dnssd_update_rrs(DnssdRegisteredService *s);
|
||||
int dnssd_signal_conflict(Manager *manager, const char *name);
|
||||
|
||||
const struct ConfigPerfItem* resolved_dnssd_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_service_name);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_service_subtype);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_service_type);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_registered_service_name);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_registered_service_subtype);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_registered_service_type);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dnssd_txt);
|
||||
|
||||
@@ -201,13 +201,13 @@ void link_add_rrs(Link *l, bool force_remove) {
|
||||
link_get_mdns_support(l) == RESOLVE_SUPPORT_YES) {
|
||||
|
||||
if (l->mdns_ipv4_scope) {
|
||||
r = dns_scope_add_dnssd_services(l->mdns_ipv4_scope);
|
||||
r = dns_scope_add_dnssd_registered_services(l->mdns_ipv4_scope);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(l, r, "Failed to add IPv4 DNS-SD services, ignoring: %m");
|
||||
}
|
||||
|
||||
if (l->mdns_ipv6_scope) {
|
||||
r = dns_scope_add_dnssd_services(l->mdns_ipv6_scope);
|
||||
r = dns_scope_add_dnssd_registered_services(l->mdns_ipv6_scope);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(l, r, "Failed to add IPv6 DNS-SD services, ignoring: %m");
|
||||
}
|
||||
@@ -215,13 +215,13 @@ void link_add_rrs(Link *l, bool force_remove) {
|
||||
} else {
|
||||
|
||||
if (l->mdns_ipv4_scope) {
|
||||
r = dns_scope_remove_dnssd_services(l->mdns_ipv4_scope);
|
||||
r = dns_scope_remove_dnssd_registered_services(l->mdns_ipv4_scope);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(l, r, "Failed to remove IPv4 DNS-SD services, ignoring: %m");
|
||||
}
|
||||
|
||||
if (l->mdns_ipv6_scope) {
|
||||
r = dns_scope_remove_dnssd_services(l->mdns_ipv6_scope);
|
||||
r = dns_scope_remove_dnssd_registered_services(l->mdns_ipv6_scope);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(l, r, "Failed to remove IPv6 DNS-SD services, ignoring: %m");
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ static int manager_dispatch_reload_signal(sd_event_source *s, const struct signa
|
||||
dns_server_unlink_on_reload(m->fallback_dns_servers);
|
||||
m->dns_extra_stub_listeners = ordered_set_free(m->dns_extra_stub_listeners);
|
||||
manager_dns_stub_stop(m);
|
||||
dnssd_service_clear_on_reload(m->dnssd_services);
|
||||
dnssd_registered_service_clear_on_reload(m->dnssd_registered_services);
|
||||
m->unicast_scope = dns_scope_free(m->unicast_scope);
|
||||
m->delegates = hashmap_free(m->delegates);
|
||||
dns_trust_anchor_flush(&m->trust_anchor);
|
||||
@@ -828,6 +828,7 @@ int manager_start(Manager *m) {
|
||||
|
||||
Manager* manager_free(Manager *m) {
|
||||
Link *l;
|
||||
DnssdRegisteredService *s;
|
||||
|
||||
if (!m)
|
||||
return NULL;
|
||||
@@ -898,10 +899,9 @@ Manager* manager_free(Manager *m) {
|
||||
free(m->llmnr_hostname);
|
||||
free(m->mdns_hostname);
|
||||
|
||||
DnssdService *s;
|
||||
while ((s = hashmap_first(m->dnssd_services)))
|
||||
dnssd_service_free(s);
|
||||
hashmap_free(m->dnssd_services);
|
||||
while ((s = hashmap_first(m->dnssd_registered_services)))
|
||||
dnssd_registered_service_free(s);
|
||||
hashmap_free(m->dnssd_registered_services);
|
||||
|
||||
dns_trust_anchor_flush(&m->trust_anchor);
|
||||
manager_etc_hosts_flush(m);
|
||||
@@ -1411,7 +1411,7 @@ int manager_find_ifindex(Manager *m, int family, const union in_addr_union *in_a
|
||||
|
||||
void manager_refresh_rrs(Manager *m) {
|
||||
Link *l;
|
||||
DnssdService *s;
|
||||
DnssdRegisteredService *s;
|
||||
|
||||
assert(m);
|
||||
|
||||
@@ -1424,7 +1424,7 @@ void manager_refresh_rrs(Manager *m) {
|
||||
link_add_rrs(l, true);
|
||||
|
||||
if (m->mdns_support == RESOLVE_SUPPORT_YES)
|
||||
HASHMAP_FOREACH(s, m->dnssd_services)
|
||||
HASHMAP_FOREACH(s, m->dnssd_registered_services)
|
||||
if (dnssd_update_rrs(s) < 0)
|
||||
log_warning("Failed to refresh DNS-SD service '%s'", s->id);
|
||||
|
||||
@@ -1862,13 +1862,13 @@ void manager_cleanup_saved_user(Manager *m) {
|
||||
}
|
||||
|
||||
bool manager_next_dnssd_names(Manager *m) {
|
||||
DnssdService *s;
|
||||
DnssdRegisteredService *s;
|
||||
bool tried = false;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
HASHMAP_FOREACH(s, m->dnssd_services) {
|
||||
HASHMAP_FOREACH(s, m->dnssd_registered_services) {
|
||||
_cleanup_free_ char * new_name = NULL;
|
||||
|
||||
if (!s->withdrawn)
|
||||
|
||||
@@ -91,7 +91,7 @@ typedef struct Manager {
|
||||
sd_event_source *mdns_ipv6_event_source;
|
||||
|
||||
/* DNS-SD */
|
||||
Hashmap *dnssd_services;
|
||||
Hashmap *dnssd_registered_services;
|
||||
|
||||
/* dbus */
|
||||
sd_bus *bus;
|
||||
|
||||
Reference in New Issue
Block a user