Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Revision 189:e1c7990486c4, committed 2021-01-21
- Comitter:
- andrewboyson
- Date:
- Thu Jan 21 13:34:33 2021 +0000
- Parent:
- 188:57f44b620d0e
- Child:
- 190:c4415a7253f5
- Commit message:
- Added test for name from Ipv4 address
Changed in this revision
--- a/resolve/nr.c Tue Jan 19 19:00:18 2021 +0000
+++ b/resolve/nr.c Thu Jan 21 13:34:33 2021 +0000
@@ -15,7 +15,8 @@
#include "ip6addr.h"
#include "ip4addr.h"
#include "nr.h"
-#include "ndp.h"
+#include "nrtest.h"
+#include "ndp.h"
bool Nr4Trace = false; //Do not use
bool NrTrace = false;
@@ -40,8 +41,6 @@
#define ADDR_TYPE_A 4
#define ADDR_TYPE_AAAA 6
-char NrTest[NR_NAME_MAX_LENGTH];
-
struct record
{
uint32_t replyMs; //Need this in addition to the ageMs for when refreshing an existing entry
@@ -673,6 +672,8 @@
clearCache (pr);
sendRequest (pr);
+
+ NrTestMain();
}
void NrInit()
{
--- a/resolve/nr.h Tue Jan 19 19:00:18 2021 +0000 +++ b/resolve/nr.h Thu Jan 21 13:34:33 2021 +0000 @@ -6,8 +6,6 @@ #define NR_NAME_MAX_LENGTH 32 -extern char NrTest[]; - extern void NrMakeRequestForNameFromAddress6(char* address6); extern void NrMakeRequestForNameFromAddress4(uint32_t address4); extern void NrMakeRequestForAddress6FromName(char* name);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/resolve/nrtest.c Thu Jan 21 13:34:33 2021 +0000
@@ -0,0 +1,27 @@
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "nr.h"
+#include "dnsquery.h"
+#include "dns.h"
+#include "eth.h"
+#include "ip4addr.h"
+
+char NrTest[NR_NAME_MAX_LENGTH];
+
+static bool _doIt = false;
+
+void NrTestNameFromAddress(void)
+{
+ _doIt = true;
+}
+
+void NrTestMain(void)
+{
+ if (!_doIt) return;
+ if (DnsQueryIsBusy) return;
+ uint32_t addr4 = Ip4AddrParse(NrTest);
+ if (!addr4) return;
+ DnsQueryNameFromIp4(addr4, DNS_PROTOCOL_MDNS, ETH_IPV4);
+ _doIt = false;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resolve/nrtest.h Thu Jan 21 13:34:33 2021 +0000 @@ -0,0 +1,5 @@ +extern char NrTest[]; + +extern void NrTestNameFromAddress(void); + +extern void NrTestMain(void); \ No newline at end of file
--- a/udp/dns/dnsserver.c Tue Jan 19 19:00:18 2021 +0000
+++ b/udp/dns/dnsserver.c Thu Jan 21 13:34:33 2021 +0000
@@ -70,6 +70,7 @@
}
bool nodeIsName = DnsNameComparePtr(p, myFullName);
bool nodeIsAddr4 = DnsNameCompareIp4(p, DhcpLocalIp);
+ if (nodeIsAddr4) LogTimeF("DnsServer received request for name from my Ip4 address\r\n");
bool nodeIsLocl6 = DnsNameCompareIp6(p, SlaacLinkLocalIp);
bool nodeIsUniq6 = DnsNameCompareIp6(p, SlaacUniqueLocalIp);
bool nodeIsGlob6 = DnsNameCompareIp6(p, SlaacGlobalIp);