-const char *iface_ip;
-int iface_index;
-
-static int
-parse_answer(struct uloop_fd *u, uint8_t *buffer, int len, uint8_t **b, int *rlen, int cache)
-{
- char *name = dns_consume_name(buffer, len, b, rlen);
- struct dns_answer *a;
- uint8_t *rdata;
-
- if (!name) {
- fprintf(stderr, "dropping: bad question\n");
- return -1;
- }
-
- a = dns_consume_answer(b, rlen);
- if (!a) {
- fprintf(stderr, "dropping: bad question\n");
- return -1;
- }
-
- rdata = *b;
- if (a->rdlength > *rlen) {
- fprintf(stderr, "dropping: bad question\n");
- return -1;
- }
-
- *rlen -= a->rdlength;
- *b += a->rdlength;
-
- if (cache)
- cache_answer(u, buffer, len, name, a, rdata);
-
- return 0;
-}
-
-static void
-parse_question(struct uloop_fd *u, char *name, struct dns_question *q)
-{
- char *host;
-
- DBG(1, "Q -> %s %s\n", dns_type_string(q->type), name);
-
- switch (q->type) {
- case TYPE_ANY:
- host = service_name("local");
- if (!strcmp(name, host))
- service_reply(u, NULL);
- break;
-
- case TYPE_PTR:
- service_announce_services(u, name);
- service_reply(u, name);
- break;
-
- case TYPE_AAAA:
- case TYPE_A:
- host = strstr(name, ".local");
- if (host)
- *host = '\0';
- if (!strcmp(hostname, name))
- service_reply_a(u, q->type);
- break;
- };
-}