heinbali01 wrote on Friday, September 14, 2018:
When I read through the LLMNR specification, it said that the Dynamic Name Server
Typo : DNS stands for Domain ( not Dynamic ) Name Server
would be checked multiple times for an IP address, and if that didn’t work and the
hostname contained no dots, then LLMNR would be used to send out a multicast request
to the LAN.
I haven’t seen that text.
But try to surf to “http://my_host/index.html” on a browser while running Wireshark: immediately you will see an LLMNR request looking for “my_host”. There will be a local MDNS request for “my_host.local”, but no real DNS request going the Internet.
What I didn’t see was the interaction between the ARP table and the local DNS table.
Aren’t ARP and a DNS table totally different and independent things?
If a node with hostname NODEA has already requested hostname NODEB (#1) and
retreived an IP, what happens when NODEB (#1) is removed from the LAN, and a different
node, using hostname NODEB (#2) , is attached that uses a different MAC & IP?
That can happen, and when using IPv4, this is an ARP problem: a device thinks that “NODE_B” has MAC-address xxx, but in fact it has a new address.
What you could do is invalidate the ARP entry by calling:
uint32_t ulARPRemoveCacheEntryByMac( const MACAddress_t * pxMACAddress );
Use eARPGetCacheEntry()
to find the current stored MAC-address,
I assume eventually the arp table entry will be removed,
Sure it will: any ARP entry will time-out when it does not get reconfirmed once in a while.
One good thing with FreeRTOS+TCP devices: each device will send-out regularly a so-called gratuitous ARP requests: the packets will be send automatically every 20 seconds ( see arpGRATUITOUS_ARP_PERIOD
). So after 20 seconds, all devices will hear about the new MAC address.
but will FreeRTOS_gethostbyname() continue to return IP from NODEB (#1) or will it go out and query the LAN?
That depends on ipconfigUSE_DNS_CACHE
: if defined as non-zero, entries will be stored in a “DNS” cache.
… if I remove the LOGGER node and replace it with bright and shiny new LOGGER,
I want logging events now sent to the new LOGGER, not the old one that isn’t there any more.
Faire enough.
As soon as you detect that the current LOGGER or LAMP stops responding, you can clear the ARP entry. The next thing to do is look-up regularly if there is a new device that is called LOGGER or LAMP.
Will removal from the ARP table also remove local DNS entry causing the next call
to FreeRTOS_getnamebyhost() to perform an actual network query instead of returning the old, stale IP?
If you have defined ipconfigUSE_DNS_CACHE
, you can remove ( clear ) a cache entry by calling:
uint32_t FreeRTOS_dnspurge( const char *pcHostName );