On 10/02/2017 23:37, Rafał Miłecki wrote:
> From: Rafał Miłecki <ra...@milecki.pl>
> 
> It seems mdns(d) was trying to support queries for two records with
> following names:
> 1) _services._dns-sd._udp.local
> 2) _services._dns-sd._tcp.local
> 
> According to the RFC 6763 Section 9 only the first one should be used
> and response PTR records should include services of both protocols: UDP
> and TCP.
> 
> This fixes discovering TCP services as in practice no other software was
> sending queries with _services._dns-sd._tcp.local.
> 
> Signed-off-by: Rafał Miłecki <ra...@milecki.pl>

Acked-by: John Crispin <j...@phrozen.org>

> ---
>  dns.c     |  4 +---
>  service.c | 15 +++------------
>  service.h |  3 +--
>  3 files changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/dns.c b/dns.c
> index 550befc..91434f2 100644
> --- a/dns.c
> +++ b/dns.c
> @@ -368,9 +368,7 @@ parse_question(struct interface *iface, char *name, 
> struct dns_question *q)
>  
>       case TYPE_PTR:
>               if (!strcmp(name, sdudp))
> -                     service_announce_services(iface, 0, announce_ttl);
> -             else if (!strcmp(name, sdtcp))
> -                     service_announce_services(iface, 1, announce_ttl);
> +                     service_announce_services(iface, announce_ttl);
>               service_reply(iface, name, announce_ttl);
>               break;
>  
> diff --git a/service.c b/service.c
> index e375fce..993e7cf 100644
> --- a/service.c
> +++ b/service.c
> @@ -66,7 +66,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);
>  char *sdudp =  "_services._dns-sd._udp.local";
> -char *sdtcp =  "_services._dns-sd._tcp.local";
>  static int service_init_announce;
>  
>  static const char *
> @@ -155,23 +154,16 @@ service_reply(struct interface *iface, const char 
> *match, int ttl)
>  }
>  
>  void
> -service_announce_services(struct interface *iface, int tcp, int ttl)
> +service_announce_services(struct interface *iface, int ttl)
>  {
>       struct service *s;
>  
>       vlist_for_each_element(&services, s, node) {
> -             if (!strstr(s->service, "._tcp") && tcp)
> -                     continue;
> -             if (!strstr(s->service, "._udp") && !tcp)
> -                     continue;
>               s->t = 0;
>               if (ttl) {
>                       dns_init_answer();
>                       service_add_ptr(s->service, ttl);
> -                     if (tcp)
> -                             dns_send_answer(iface, sdtcp);
> -                     else
> -                             dns_send_answer(iface, sdudp);
> +                     dns_send_answer(iface, sdudp);
>               }
>               service_reply_single(iface, s, ttl, 0);
>       }
> @@ -180,8 +172,7 @@ service_announce_services(struct interface *iface, int 
> tcp, int ttl)
>  void
>  service_announce(struct interface *iface, int ttl)
>  {
> -     service_announce_services(iface, 0, ttl);
> -     service_announce_services(iface, 1, ttl);
> +     service_announce_services(iface, ttl);
>  }
>  
>  static void
> diff --git a/service.h b/service.h
> index 901bcbd..78ee854 100644
> --- a/service.h
> +++ b/service.h
> @@ -15,11 +15,10 @@
>  #define _SERVICE_H__
>  
>  extern char *sdudp;
> -extern char *sdtcp;
>  extern void service_init(int announce);
>  extern void service_cleanup(void);
>  extern void service_announce(struct interface *iface, int ttl);
>  extern void service_reply(struct interface *iface, const char *match, int 
> ttl);
> -extern void service_announce_services(struct interface *iface, int tcp, int 
> ttl);
> +extern void service_announce_services(struct interface *iface, int ttl);
>  
>  #endif
> 

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to