[LEDE-DEV,1/3] Handle SRV questions

Submitted by Cristian Morales Vega on April 26, 2017, 8:45 a.m.

Details

Message ID 20170426084516.9525-1-cristian@samknows.com
State New
Delegated to: Rafał Miłecki
Headers show

Commit Message

Cristian Morales Vega April 26, 2017, 8:45 a.m.
Signed-off-by: Cristian Morales Vega <cristian@samknows.com>
---
 dns.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Philip Prindeville April 26, 2017, 9:56 p.m.
> On Apr 26, 2017, at 3:45 AM, Cristian Morales Vega <cristian@samknows.com> wrote:
> 
> Signed-off-by: Cristian Morales Vega <cristian@samknows.com>
> ---
> dns.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
> 
> diff --git a/dns.c b/dns.c
> index d384f58..61ea8e3 100644
> --- a/dns.c
> +++ b/dns.c
> @@ -390,6 +390,20 @@ parse_question(struct interface *iface, struct sockaddr *from, char *name, struc
> 		}
> 		break;
> 
> +	case TYPE_SRV:
> +		{
> +		/* First dot separates instance name from the rest */
> +		char *dot = strchr(name, '.');
> +		/* Length of queried instance */
> +		size_t len = dot ? dot - name : 0;
> +
> +		/* Make sure it's query for the instance name we use */
> +		if (len && len == strlen(mdns_hostname) &&
> +		    !strncmp(name, mdns_hostname, len))
> +			service_reply(iface, to, dot + 1, announce_ttl);
> +		}
> +		break;
> +
> 	case TYPE_AAAA:
> 	case TYPE_A:
> 		host = strstr(name, ".local”);


Uh…  What package is this for?

-Philip

Patch hide | download patch | download mbox

diff --git a/dns.c b/dns.c
index d384f58..61ea8e3 100644
--- a/dns.c
+++ b/dns.c
@@ -390,6 +390,20 @@  parse_question(struct interface *iface, struct sockaddr *from, char *name, struc
 		}
 		break;
 
+	case TYPE_SRV:
+		{
+		/* First dot separates instance name from the rest */
+		char *dot = strchr(name, '.');
+		/* Length of queried instance */
+		size_t len = dot ? dot - name : 0;
+
+		/* Make sure it's query for the instance name we use */
+		if (len && len == strlen(mdns_hostname) &&
+		    !strncmp(name, mdns_hostname, len))
+			service_reply(iface, to, dot + 1, announce_ttl);
+		}
+		break;
+
 	case TYPE_AAAA:
 	case TYPE_A:
 		host = strstr(name, ".local");