A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

Revision:
32:679654f2d023
Parent:
30:e34173b7585c
Child:
33:714a0345e59b
--- a/udp/dns/dnsquery.cpp	Fri Aug 11 17:41:52 2017 +0000
+++ b/udp/dns/dnsquery.cpp	Thu Aug 17 14:21:02 2017 +0000
@@ -63,7 +63,7 @@
 }
 void DnsQueryIp4FromName(char * name, int protocol)
 {
-    strcpy(DnsQueryName, name);
+    DnsMakeFullNameFromName(protocol, name, sizeof(DnsQueryName), DnsQueryName);
     DnsQueryIp4        = 0;
     DnsQueryIp6[0]     = 0;
     DnsQueryIsBusy     = true;
@@ -73,7 +73,10 @@
 }
 void DnsQueryIp6FromName(char * name, int protocol)
 {
-    strcpy(DnsQueryName, name);
+    DnsMakeFullNameFromName(protocol, name, sizeof(DnsQueryName), DnsQueryName);
+    char text[60];
+    DnsProtocolToString(protocol, sizeof(text), text);
+    LogTimeF("DnsQueryIp6FromName %s, %s, %s\r\n", name, text, DnsQueryName);
     DnsQueryIp4        = 0;
     DnsQueryIp6[0]     = 0;
     DnsQueryIsBusy     = true;
@@ -103,10 +106,9 @@
 }
 static void logQuery()
 {
-    if (!DEBUG) return;
     char text[60];
     DnsProtocolToString(DnsQueryProtocol, sizeof(text), text);
-    LogTimeF("%s sent request for ", text);
+    LogTimeF("DnsQuery sent %s request for ", text);
     DnsRecordTypeToString(DnsQueryRecordType, sizeof(text), text);
     LogF("%s ", text);
     if (DnsQueryIp4) //Reverse
@@ -129,7 +131,7 @@
     if (!DnsQueryIsBusy)                                           return DO_NOTHING;
     if (DnsQueryProtocol == DNS_PROTOCOL_UDNS && DhcpLocalIp == 0) return DO_NOTHING;
     
-    logQuery();
+    if (DEBUG) logQuery();
     
     static uint16_t id = 0;
     DnsHdrId = ++id;