From 9f1cc226e4be47d32e4df796c94cbee1437960aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 20 Mar 2017 17:35:21 +0100 Subject: [PATCH] Fix replying to "QU" questions received on unicast interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We may receive questions on unicast interface, e.g. when another client is refreshing its entries. "QU" questions are "questions requesting unicast responses" which means we should obviously send unicast replies. Old code wasn't setting "to" variable correctly so IP address wasn't passed back to the interface layer. It means replies were never sent. Signed-off-by: Rafał Miłecki --- dns.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dns.c b/dns.c index b19ad17..51a0150 100644 --- a/dns.c +++ b/dns.c @@ -351,15 +351,14 @@ parse_answer(struct interface *iface, uint8_t *buffer, int len, uint8_t **b, int static void parse_question(struct interface *iface, struct sockaddr *from, char *name, struct dns_question *q) { - struct sockaddr *to; + struct sockaddr *to = NULL; char *host; /* TODO: Multicast if more than one quarter of TTL has passed */ - if ((q->class & CLASS_UNICAST) && iface->multicast) { - iface = iface->peer; + if (q->class & CLASS_UNICAST) { to = from; - } else { - to = NULL; + if (iface->multicast) + iface = iface->peer; } DBG(1, "Q -> %s %s\n", dns_type_string(q->type), name); -- 2.25.1