From: Rafał Miłecki Date: Mon, 20 Mar 2017 12:59:04 +0000 (+0100) Subject: Use one define for DNS-Based Service Discovery service name X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmdnsd.git;a=commitdiff_plain;h=ce7e9e939dbf4e100bfece5a46b3ef17fd99d034 Use one define for DNS-Based Service Discovery service name Signed-off-by: Rafał Miłecki --- diff --git a/dns.c b/dns.c index 7c49236..2e8b0ba 100644 --- a/dns.c +++ b/dns.c @@ -373,7 +373,7 @@ parse_question(struct interface *iface, struct sockaddr *from, char *name, struc break; case TYPE_PTR: - if (!strcmp(name, sdudp)) { + if (!strcmp(name, C_DNS_SD)) { dns_reply_a(iface, to, announce_ttl); service_announce_services(iface, to, announce_ttl); } else { diff --git a/dns.h b/dns.h index 0f26f60..38ab41f 100644 --- a/dns.h +++ b/dns.h @@ -40,7 +40,7 @@ #define MAX_NAME_LEN 8096 #define MAX_DATA_LEN 8096 -#define C_DNS_SD "_services._dns-sd._udp.local" +#define C_DNS_SD "_services._dns-sd._udp.local" struct dns_header { uint16_t id; diff --git a/interface.c b/interface.c index cde184b..a984be9 100644 --- a/interface.c +++ b/interface.c @@ -441,7 +441,7 @@ reconnect_socket4(struct uloop_timeout *timeout) uloop_fd_add(&iface->fd, ULOOP_READ); if (iface->multicast) { - dns_send_question(iface, "_services._dns-sd._udp.local", TYPE_PTR, 0); + dns_send_question(iface, C_DNS_SD, TYPE_PTR, 0); announce_init(iface); } @@ -489,7 +489,7 @@ reconnect_socket6(struct uloop_timeout *timeout) uloop_fd_add(&iface->fd, ULOOP_READ); if (iface->multicast) { - dns_send_question(iface, "_services._dns-sd._udp.local", TYPE_PTR, 0); + dns_send_question(iface, C_DNS_SD, TYPE_PTR, 0); announce_init(iface); } diff --git a/service.c b/service.c index 075ac15..ca70274 100644 --- a/service.c +++ b/service.c @@ -65,7 +65,6 @@ service_update(struct vlist_tree *tree, struct vlist_node *node_new, static struct blob_buf b; static VLIST_TREE(services, avl_strcmp, service_update, false, false); -const char *sdudp = "_services._dns-sd._udp.local"; static int service_init_announce; static const char * @@ -163,7 +162,7 @@ service_announce_services(struct interface *iface, struct sockaddr *to, int ttl) if (ttl) { dns_init_answer(); service_add_ptr(s->service, ttl); - dns_send_answer(iface, to, sdudp); + dns_send_answer(iface, to, C_DNS_SD); } service_reply_single(iface, to, s, ttl, 0); } diff --git a/service.h b/service.h index 67a425a..086a0af 100644 --- a/service.h +++ b/service.h @@ -14,7 +14,6 @@ #ifndef _SERVICE_H__ #define _SERVICE_H__ -extern const char *sdudp; extern void service_init(int announce); extern void service_cleanup(void); extern void service_reply(struct interface *iface, struct sockaddr *to, const char *match, int ttl); diff --git a/ubus.c b/ubus.c index 0cfd18f..ba89fdd 100644 --- a/ubus.c +++ b/ubus.c @@ -176,7 +176,7 @@ umdns_query(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *msg) { struct blob_attr *tb[QUERY_MAX], *c; - const char *question = "_services._dns-sd._udp.local"; + const char *question = C_DNS_SD; const char *ifname; int type = TYPE_ANY;