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 <rafal@milecki.pl>
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);