Revision: 14934
Author:   adrian.chadd
Date:     Fri Jul 22 20:11:06 2011
Log:      Introduce some (completely untested) IPv6 PTR lookup code.


http://code.google.com/p/lusca-cache/source/detail?r=14934

Modified:
 /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.c
 /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.h

=======================================
--- /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.c Tue Jan 18 17:13:51 2011 +++ /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.c Fri Jul 22 20:11:06 2011
@@ -997,3 +997,46 @@
     idnsCacheQuery(q);
     idnsSendQuery(q);
 }
+
+void
+idnsPTR6Lookup(const sqaddr_t *addr, IDNSCB *callback, void *data)
+{
+    idns_query *q;
+    struct in6_addr addr6;
+
+    addr6 = sqinet_get_v6_inaddr(addr, SQADDR_ASSERT_IS_V6);
+
+    q = cbdataAlloc(idns_query);
+    q->tcp_socket = -1;
+    q->id = idnsQueryID();
+    q->sz = rfc3596BuildPTR6Query(addr6, q->buf, sizeof(q->buf), q->id,
+      &q->query);
+
+    /* PTR does not do inbound A/AAAA */
+    q->need_A = 0;
+
+    if (do_debug(78, 3)) {
+        char sbuf[MAX_IPSTRLEN];
+        (void) sqinet_ntoa(addr, sbuf, sizeof(sbuf), SQADDR_NONE);
+        debug(78, 3) ("%s: buf is %d bytes for %s, id = %#hx\n",
+          __func__, (int) q->sz, sbuf, q->id);
+    }
+    if (q->sz < 0) {
+        /* problem with query data -- query not sent */
+        callback(data, NULL, 0, "Internal error");
+        safe_free(q->initial_AAAA.answers);
+        cbdataFree(q);
+        return;
+    }
+    if (idnsCachedLookup(q->query.name, callback, data)) {
+        safe_free(q->initial_AAAA.answers);
+        cbdataFree(q);
+        return;
+    }
+    q->callback = callback;
+    q->callback_data = data;
+    cbdataLock(q->callback_data);
+    q->start_t = current_time;
+    idnsCacheQuery(q);
+    idnsSendQuery(q);
+}
=======================================
--- /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.h Tue Jan 18 17:13:51 2011 +++ /playpen/LUSCA_HEAD_ipv6/libsqdns/dns_internal.h Fri Jul 22 20:11:06 2011
@@ -111,5 +111,6 @@
 extern void idnsShutdown(void);
 extern void idnsALookup(const char *, IDNSCB *, void *);
 extern void idnsPTRLookup(const struct in_addr, IDNSCB *, void *);
+extern void idnsPTR6Lookup(const sqaddr_t *addr, IDNSCB *callback, void *data);

 #endif

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to