print ttl when receiving a PTR record
[project/mdnsd.git] / cache.c
diff --git a/cache.c b/cache.c
index c78a3b7a9b438118b369c68c3102fd62cad0b9ee..2b5ca541d3216f4e34aac837f5102722ef4857fe 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -120,7 +120,7 @@ cache_scan(void)
 
        vlist_for_each_element(&interfaces, iface, node)
                avl_for_each_element(&entries, s, avl)
-                       dns_send_question(iface, s->entry, TYPE_PTR);
+                       dns_send_question(iface, s->entry, TYPE_PTR, 1);
 }
 
 static struct cache_entry*
@@ -154,7 +154,7 @@ cache_entry(struct interface *iface, char *entry, int hlen, int ttl)
        avl_insert(&entries, &s->avl);
 
        if (!hlen)
-               dns_send_question(iface, entry, TYPE_PTR);
+               dns_send_question(iface, entry, TYPE_PTR, !iface->multicast);
 
        return s;
 }
@@ -216,7 +216,7 @@ cache_host_is_known(char *record)
 }
 
 void
-cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struct dns_answer *a, uint8_t *rdata)
+cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struct dns_answer *a, uint8_t *rdata, int flush)
 {
        struct dns_srv_data *dsd = (struct dns_srv_data *) rdata;
        struct cache_record *r;
@@ -227,9 +227,6 @@ cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struc
        int host_len = 0;
        static char *rdata_buffer = (char *) mdns_buf;
 
-       if (!(a->class & CLASS_IN))
-               return;
-
        nlen = strlen(name);
 
        switch (a->type) {
@@ -242,7 +239,7 @@ cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struc
                        return;
                }
 
-               DBG(1, "A -> %s %s %s\n", dns_type_string(a->type), name, rdata_buffer);
+               DBG(1, "A -> %s %s %s ttl:%d\n", dns_type_string(a->type), name, rdata_buffer, a->ttl);
 
                rdlength = strlen(rdata_buffer);