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
Diff: udp/dns/dnsreply.cpp
- Revision:
- 57:e0fb648acf48
- Parent:
- 50:492f2d2954e4
- Child:
- 58:d48c899e482f
diff -r 35117a8b5c65 -r e0fb648acf48 udp/dns/dnsreply.cpp --- a/udp/dns/dnsreply.cpp Tue Nov 14 17:43:08 2017 +0000 +++ b/udp/dns/dnsreply.cpp Tue Nov 28 17:05:46 2017 +0000 @@ -118,9 +118,41 @@ if (DnsReplyRecordNameAsIp6[0] && DnsReplyName[0] ) Nr6AddIpRecord(DnsReplyRecordNameAsIp6, strippedName, dnsProtocol); } int DnsReplyHandle(void (*traceback)(void), int dnsProtocol, int *pSize) -{ - if (!DnsHdrAncount) return DO_NOTHING; - if (DnsReplyTrace) +{ + bool ok = true; + if (!DnsHdrAncount) ok = false; + + p = DnsHdrData; + + if (ok) + { + for (int q = 0; q < DnsHdrQdcount; q++) + { + if (scanQuery()) + { + ok = false; + break; + } + } + } + if (ok) + { + for (int a = 0; a < DnsHdrAncount; a++) + { + if (scanAnswer()) + { + ok = false; + break; + } + readAnswer(); + sendToDnsCache(dnsProtocol); + } + } + + NetTraceHostCheckIp6(DnsReplyIp6); + NetTraceHostCheckIp6(DnsReplyRecordNameAsIp6); + + if (DnsReplyTrace || NetTraceHostGetMatched()) { if (NetTraceNewLine) Log("\r\n"); LogTimeF("DnsReply received\r\n"); @@ -128,18 +160,6 @@ DnsHdrLog(dnsProtocol); } - p = DnsHdrData; - - for (int q = 0; q < DnsHdrQdcount; q++) - { - if (scanQuery()) return DO_NOTHING; - } - for (int a = 0; a < DnsHdrAncount; a++) - { - if (scanAnswer()) return DO_NOTHING; - readAnswer(); - sendToDnsCache(dnsProtocol); - } return DO_NOTHING; }