send queries as both A and AAAA
authorPhilipp Tölke <toelke@in.tum.de>
Tue, 18 Oct 2011 18:41:16 +0000 (18:41 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Tue, 18 Oct 2011 18:41:16 +0000 (18:41 +0000)
src/vpn/gnunet-service-dns.c

index e0692937bb0fc6b8bd8cdc46a339aa135c0dac0e..49e774dc2fdf32358a8bf6bb1e88be56782683cf 100644 (file)
@@ -917,6 +917,32 @@ receive_query (void *cls
             cls_->hdr.size - sizeof (struct GNUNET_MessageHeader));
     GNUNET_SCHEDULER_add_now (send_mesh_query, cls_);
 
+    if (pdns->s.qdcount == 1)
+      {
+        if (pdns->queries[0]->qtype == 1)
+          pdns->queries[0]->qtype = 28;
+        else if (pdns->queries[0]->qtype == 28)
+          pdns->queries[0]->qtype = 1;
+        else
+          goto outfree;
+        struct dns_pkt *rdns = unparse_dns_packet (pdns);
+        size_t size =
+          sizeof (struct GNUNET_MESH_Tunnel *) +
+          sizeof (struct GNUNET_MessageHeader) + (ntohs (message->size) -
+                                                  sizeof (struct query_packet) +
+                                                  1);
+        struct tunnel_cls *cls_ = GNUNET_malloc (size);
+
+        cls_->hdr.size = size - sizeof (struct GNUNET_MESH_Tunnel *);
+
+        cls_->hdr.type = ntohs (GNUNET_MESSAGE_TYPE_VPN_REMOTE_QUERY_DNS);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "size: %d\n", size);
+
+        memcpy (&cls_->dns, rdns,
+                cls_->hdr.size - sizeof (struct GNUNET_MessageHeader));
+        GNUNET_SCHEDULER_add_now (send_mesh_query, cls_);
+      }
+
     goto outfree;
   }