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

Cristian Morales Vega cristian at samknows.com
Wed Apr 26 01:45:14 PDT 2017


Signed-off-by: Cristian Morales Vega <cristian at 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");
-- 
2.9.3




More information about the Lede-dev mailing list