}
void
-dns_add_answer(int type, const uint8_t *rdata, uint16_t rdlength)
+dns_add_answer(int type, const uint8_t *rdata, uint16_t rdlength, int ttl)
{
struct blob_attr *attr;
struct dns_answer *a;
a = blob_data(attr);
a->type = cpu_to_be16(type);
a->class = cpu_to_be16(1);
- a->ttl = cpu_to_be32(announce_ttl);
+ a->ttl = cpu_to_be32(ttl);
a->rdlength = cpu_to_be16(rdlength);
memcpy(a + 1, rdata, rdlength);
switch (q->type) {
case TYPE_ANY:
if (!strcmp(name, mdns_hostname_local))
- service_reply(iface, NULL);
+ service_reply(iface, NULL, announce_ttl);
break;
case TYPE_PTR:
service_announce_services(iface, name);
- service_reply(iface, name);
+ service_reply(iface, name, announce_ttl);
break;
case TYPE_AAAA:
if (host)
*host = '\0';
if (!strcmp(mdns_hostname, name))
- service_reply_a(iface, q->type);
+ service_reply_a(iface, q->type, announce_ttl);
break;
};
}