llmnr_client.c
Go to the documentation of this file.
1 /**
2  * @file llmnr_client.c
3  * @brief LLMNR client (Link-Local Multicast Name Resolution)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL LLMNR_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ipv4/ipv4_misc.h"
37 #include "llmnr/llmnr_client.h"
38 #include "dns/dns_debug.h"
39 #include "debug.h"
40 
41 //Check TCP/IP stack configuration
42 #if (LLMNR_CLIENT_SUPPORT == ENABLED)
43 
44 
45 /**
46  * @brief Resolve a host name using LLMNR
47  * @param[in] interface Underlying network interface
48  * @param[in] name Name of the host to be resolved
49  * @param[in] type Host type (IPv4 or IPv6)
50  * @param[out] ipAddr IP address corresponding to the specified host name
51  **/
52 
55 {
56  error_t error;
57  DnsCacheEntry *entry;
58 
59 #if (NET_RTOS_SUPPORT == ENABLED)
60  systime_t delay;
61 
62  //Debug message
63  TRACE_INFO("Resolving host name %s (LLMNR resolver)...\r\n", name);
64 #endif
65 
66  //Get exclusive access
68 
69  //Search the DNS cache for the specified host name
70  entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_LLMNR);
71 
72  //Check whether a matching entry has been found
73  if(entry != NULL)
74  {
75  //Host name already resolved?
76  if(entry->state == DNS_STATE_RESOLVED ||
77  entry->state == DNS_STATE_PERMANENT)
78  {
79  //Return the corresponding IP address
80  *ipAddr = entry->ipAddr;
81  //Successful host name resolution
82  error = NO_ERROR;
83  }
84  else
85  {
86  //Host name resolution is in progress
87  error = ERROR_IN_PROGRESS;
88  }
89  }
90  else
91  {
92  //If no entry exists, then create a new one
93  entry = dnsCreateEntry();
94 
95  //Record the host name whose IP address is unknown
96  osStrcpy(entry->name, name);
97 
98  //Initialize DNS cache entry
99  entry->type = type;
101  entry->interface = interface;
102 
103  //Get an ephemeral port number
104  entry->port = udpGetDynamicPort();
105 
106  //An identifier is used by the LLMNR client to match replies with
107  //corresponding requests
108  entry->id = (uint16_t) netGenerateRand();
109 
110  //Callback function to be called when a LLMNR response is received
111  error = udpAttachRxCallback(interface, entry->port, llmnrProcessResponse,
112  NULL);
113 
114  //Check status code
115  if(!error)
116  {
117  //Initialize retransmission counter
119  //Send LLMNR query
120  error = llmnrSendQuery(entry);
121 
122  //LLMNR message successfully sent?
123  if(!error)
124  {
125  //Save the time at which the query message was sent
126  entry->timestamp = osGetSystemTime();
127  //Set timeout value
130  //Decrement retransmission counter
131  entry->retransmitCount--;
132 
133  //Switch state
134  entry->state = DNS_STATE_IN_PROGRESS;
135  //Host name resolution is in progress
136  error = ERROR_IN_PROGRESS;
137  }
138  else
139  {
140  //Unregister callback function
141  udpDetachRxCallback(interface, entry->port);
142  }
143  }
144  }
145 
146  //Release exclusive access
148 
149 #if (NET_RTOS_SUPPORT == ENABLED)
150  //Set default polling interval
152 
153  //Wait the host name resolution to complete
154  while(error == ERROR_IN_PROGRESS)
155  {
156  //Wait until the next polling period
157  osDelayTask(delay);
158 
159  //Get exclusive access
161 
162  //Search the DNS cache for the specified host name
163  entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_LLMNR);
164 
165  //Check whether a matching entry has been found
166  if(entry != NULL)
167  {
168  //Host name successfully resolved?
169  if(entry->state == DNS_STATE_RESOLVED)
170  {
171  //Return the corresponding IP address
172  *ipAddr = entry->ipAddr;
173  //Successful host name resolution
174  error = NO_ERROR;
175  }
176  }
177  else
178  {
179  //Host name resolution failed
180  error = ERROR_FAILURE;
181  }
182 
183  //Release exclusive access
185 
186  //Backoff support for less aggressive polling
187  delay = MIN(delay * 2, DNS_CACHE_MAX_POLLING_INTERVAL);
188  }
189 
190  //Check status code
191  if(error)
192  {
193  //Failed to resolve host name
194  TRACE_INFO("Host name resolution failed!\r\n");
195  }
196  else
197  {
198  //Successful host name resolution
199  TRACE_INFO("Host name resolved to %s...\r\n", ipAddrToString(ipAddr, NULL));
200  }
201 #endif
202 
203  //Return status code
204  return error;
205 }
206 
207 
208 /**
209  * @brief Send a LLMNR query message
210  * @param[in] entry Pointer to a valid DNS cache entry
211  * @return Error code
212  **/
213 
215 {
216  error_t error;
217  size_t length;
218  size_t offset;
219  NetBuffer *buffer;
221  DnsQuestion *dnsQuestion;
223  NetTxAncillary ancillary;
224 
225 #if (IPV4_SUPPORT == ENABLED)
226  //An IPv4 address is expected?
227  if(entry->type == HOST_TYPE_IPV4)
228  {
229  //The IPv4 link-scope multicast address to which a sender sends queries
230  //is 224.0.0.252
231  destIpAddr.length = sizeof(Ipv4Addr);
233  }
234  else
235 #endif
236 #if (IPV6_SUPPORT == ENABLED)
237  //An IPv6 address is expected?
238  if(entry->type == HOST_TYPE_IPV6)
239  {
240  //The IPv6 link-scope multicast address to which a sender sends queries
241  //is ff02:0:0:0:0:0:1:3
242  destIpAddr.length = sizeof(Ipv6Addr);
244  }
245  else
246 #endif
247  //Invalid host type?
248  {
249  //Report an error
251  }
252 
253  //Allocate a memory buffer to hold the LLMNR query message
254  buffer = udpAllocBuffer(LLMNR_MESSAGE_MAX_SIZE, &offset);
255  //Failed to allocate buffer?
256  if(buffer == NULL)
257  return ERROR_OUT_OF_MEMORY;
258 
259  //Point to the LLMNR header
260  message = netBufferAt(buffer, offset, 0);
261 
262  //Format LLMNR query message
263  message->id = htons(entry->id);
264  message->qr = 0;
265  message->opcode = DNS_OPCODE_QUERY;
266  message->c = 0;
267  message->tc = 0;
268  message->t = 0;
269  message->z = 0;
270  message->rcode = DNS_RCODE_NOERROR;
271 
272  //The LLMNR query contains one question
273  message->qdcount = HTONS(1);
274  message->ancount = 0;
275  message->nscount = 0;
276  message->arcount = 0;
277 
278  //Length of the LLMNR query message
279  length = sizeof(DnsHeader);
280 
281  //Encode the host name using the DNS name notation
282  length += dnsEncodeName(entry->name, message->questions);
283 
284  //Point to the corresponding question structure
285  dnsQuestion = DNS_GET_QUESTION(message, length);
286 
287 #if (IPV4_SUPPORT == ENABLED)
288  //An IPv4 address is expected?
289  if(entry->type == HOST_TYPE_IPV4)
290  {
291  //Fill in question structure
292  dnsQuestion->qtype = HTONS(DNS_RR_TYPE_A);
293  dnsQuestion->qclass = HTONS(DNS_RR_CLASS_IN);
294  }
295 #endif
296 #if (IPV6_SUPPORT == ENABLED)
297  //An IPv6 address is expected?
298  if(entry->type == HOST_TYPE_IPV6)
299  {
300  //Fill in question structure
301  dnsQuestion->qtype = HTONS(DNS_RR_TYPE_AAAA);
302  dnsQuestion->qclass = HTONS(DNS_RR_CLASS_IN);
303  }
304 #endif
305 
306  //Update the length of the LLMNR query message
307  length += sizeof(DnsQuestion);
308 
309  //Adjust the length of the multi-part buffer
310  netBufferSetLength(buffer, offset + length);
311 
312  //Debug message
313  TRACE_INFO("Sending LLMNR message (%" PRIuSIZE " bytes)...\r\n", length);
314  //Dump message
316 
317  //Additional options can be passed to the stack along with the packet
318  ancillary = NET_DEFAULT_TX_ANCILLARY;
319 
320  //For UDP queries, the Hop Limit field in the IPv6 header and the TTL
321  //field in the IPV4 header MAY be set to any value. However, it is
322  //recommended that the value 255 be used for compatibility with early
323  //implementations (refer to RFC 4795, section 2.5)
324  ancillary.ttl = LLMNR_DEFAULT_QUERY_IP_TTL;
325 
326  //LLMNR queries are sent to and received on port 5355
327  error = udpSendBuffer(entry->interface, NULL, entry->port, &destIpAddr,
328  LLMNR_PORT, buffer, offset, &ancillary);
329 
330  //Free previously allocated memory
331  netBufferFree(buffer);
332 
333  //Return status code
334  return error;
335 }
336 
337 
338 /**
339  * @brief Process LLMNR response message
340  * @param[in] interface Underlying network interface
341  * @param[in] pseudoHeader UDP pseudo header
342  * @param[in] udpHeader UDP header
343  * @param[in] buffer Multi-part buffer containing the incoming LLMNR message
344  * @param[in] offset Offset to the first byte of the LLMNR message
345  * @param[in] ancillary Additional options passed to the stack along with
346  * the packet
347  * @param[in] param Callback function parameter (not used)
348  **/
349 
351  const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
352  const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
353  void *param)
354 {
355  uint_t i;
356  uint_t j;
357  size_t pos;
358  size_t length;
360  DnsQuestion *question;
361  DnsResourceRecord *record;
362  DnsCacheEntry *entry;
363 
364  //Retrieve the length of the LLMNR message
365  length = netBufferGetLength(buffer) - offset;
366 
367  //Malformed LLMNR message?
368  if(length < sizeof(LlmnrHeader))
369  return;
370 
371  //Point to the LLMNR message header
372  message = netBufferAt(buffer, offset, length);
373  //Sanity check
374  if(message == NULL)
375  return;
376 
377  //Debug message
378  TRACE_INFO("LLMNR message received (%" PRIuSIZE " bytes)...\r\n", length);
379  //Dump message
381 
382  //Discard LLMNR queries
383  if(!message->qr)
384  return;
385 
386  //LLMNR messages received with an opcode other than zero must be silently
387  //ignored
388  if(message->opcode != DNS_OPCODE_QUERY)
389  return;
390 
391  //LLMNR messages received with non-zero response codes must be silently
392  //ignored
393  if(message->rcode != DNS_RCODE_NOERROR)
394  return;
395 
396  //LLMNR senders must silently discard LLMNR responses with QDCOUNT not
397  //equal to one (refer to RFC 4795, section 2.1.1)
398  if(ntohs(message->qdcount) != 1)
399  return;
400 
401  //Loop through DNS cache entries
402  for(i = 0; i < DNS_CACHE_SIZE; i++)
403  {
404  //Point to the current entry
405  entry = &dnsCache[i];
406 
407  //LLMNR name resolution in progress?
408  if(entry->state == DNS_STATE_IN_PROGRESS &&
410  {
411  //Check destination port number
412  if(entry->port == ntohs(udpHeader->destPort))
413  {
414  //Compare identifier against the expected one
415  if(ntohs(message->id) != entry->id)
416  break;
417 
418  //Point to the first question
419  pos = sizeof(DnsHeader);
420  //Parse domain name
421  pos = dnsParseName((DnsHeader *) message, length, pos, NULL, 0);
422 
423  //Invalid name?
424  if(!pos)
425  break;
426  //Malformed DNS message?
427  if((pos + sizeof(DnsQuestion)) > length)
428  break;
429 
430  //Compare domain name
432  entry->name, 0))
433  {
434  break;
435  }
436 
437  //Point to the corresponding entry
438  question = DNS_GET_QUESTION(message, pos);
439 
440  //Check the class of the query
441  if(ntohs(question->qclass) != DNS_RR_CLASS_IN)
442  break;
443 
444  //Check the type of the query
445  if(entry->type == HOST_TYPE_IPV4 &&
446  ntohs(question->qtype) != DNS_RR_TYPE_A)
447  {
448  break;
449  }
450 
451  if(entry->type == HOST_TYPE_IPV6 &&
452  ntohs(question->qtype) != DNS_RR_TYPE_AAAA)
453  {
454  break;
455  }
456 
457  //Point to the first answer
458  pos += sizeof(DnsQuestion);
459 
460  //Parse answer resource records
461  for(j = 0; j < ntohs(message->ancount); j++)
462  {
463  //Parse domain name
464  pos = dnsParseName((DnsHeader *) message, length, pos, NULL, 0);
465  //Invalid name?
466  if(!pos)
467  break;
468 
469  //Point to the associated resource record
470  record = DNS_GET_RESOURCE_RECORD(message, pos);
471  //Point to the resource data
472  pos += sizeof(DnsResourceRecord);
473 
474  //Make sure the resource record is valid
475  if(pos > length)
476  break;
477  if((pos + ntohs(record->rdlength)) > length)
478  break;
479 
480 #if (IPV4_SUPPORT == ENABLED)
481  //IPv4 address expected?
482  if(entry->type == HOST_TYPE_IPV4)
483  {
484  //A resource record found?
485  if(ntohs(record->rtype) == DNS_RR_TYPE_A &&
486  ntohs(record->rdlength) == sizeof(Ipv4Addr))
487  {
488  //Copy the IPv4 address
489  entry->ipAddr.length = sizeof(Ipv4Addr);
490  ipv4CopyAddr(&entry->ipAddr.ipv4Addr, record->rdata);
491 
492  //Save current time
493  entry->timestamp = osGetSystemTime();
494  //Save TTL value
495  entry->timeout = ntohl(record->ttl) * 1000;
496  //Limit the lifetime of the NBNS cache entries
497  entry->timeout = MIN(entry->timeout, LLMNR_MAX_LIFETIME);
498 
499  //Unregister UDP callback function
500  udpDetachRxCallback(interface, entry->port);
501  //Host name successfully resolved
502  entry->state = DNS_STATE_RESOLVED;
503  //Exit immediately
504  break;
505  }
506  }
507 #endif
508 #if (IPV6_SUPPORT == ENABLED)
509  //IPv6 address expected?
510  if(entry->type == HOST_TYPE_IPV6)
511  {
512  //AAAA resource record found?
513  if(ntohs(record->rtype) == DNS_RR_TYPE_AAAA &&
514  ntohs(record->rdlength) == sizeof(Ipv6Addr))
515  {
516  //Copy the IPv6 address
517  entry->ipAddr.length = sizeof(Ipv6Addr);
518  ipv6CopyAddr(&entry->ipAddr.ipv6Addr, record->rdata);
519 
520  //Save current time
521  entry->timestamp = osGetSystemTime();
522  //Save TTL value
523  entry->timeout = ntohl(record->ttl) * 1000;
524  //Limit the lifetime of the NBNS cache entries
525  entry->timeout = MIN(entry->timeout, LLMNR_MAX_LIFETIME);
526 
527  //Unregister UDP callback function
528  udpDetachRxCallback(interface, entry->port);
529  //Host name successfully resolved
530  entry->state = DNS_STATE_RESOLVED;
531  //Exit immediately
532  break;
533  }
534  }
535 #endif
536  //Point to the next resource record
537  pos += ntohs(record->rdlength);
538  }
539 
540  //We are done
541  break;
542  }
543  }
544  }
545 }
546 
547 #endif
#define LLMNR_DEFAULT_QUERY_IP_TTL
Definition: llmnr_common.h:55
#define htons(value)
Definition: cpu_endian.h:413
HostType
Host types.
Definition: socket.h:215
@ DNS_STATE_PERMANENT
Definition: dns_cache.h:88
HostType type
IPv4 or IPv6 host?
Definition: dns_cache.h:99
#define LLMNR_MAX_LIFETIME
Definition: llmnr_client.h:72
const NetTxAncillary NET_DEFAULT_TX_ANCILLARY
Definition: net_misc.c:71
#define netMutex
Definition: net_legacy.h:195
IP network address.
Definition: ip.h:90
@ DNS_OPCODE_QUERY
Query.
Definition: dns_common.h:81
#define LLMNR_CLIENT_MAX_TIMEOUT
Definition: llmnr_client.h:65
LlmnrHeader
Definition: llmnr_common.h:105
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t message[]
Definition: chap.h:154
error_t llmnrSendQuery(DnsCacheEntry *entry)
Send a LLMNR query message.
Definition: llmnr_client.c:214
systime_t timeout
Retransmission timeout.
Definition: dns_cache.h:108
@ HOST_NAME_RESOLVER_LLMNR
Definition: socket.h:232
char_t * ipAddrToString(const IpAddr *ipAddr, char_t *str)
Convert a binary IP address to a string representation.
Definition: ip.c:805
size_t dnsParseName(const DnsHeader *message, size_t length, size_t pos, char_t *dest, uint_t level)
Decode a domain name that uses the DNS name encoding.
Definition: dns_common.c:132
Ipv6Addr
Definition: ipv6.h:260
uint8_t type
Definition: coap_common.h:176
@ ERROR_OUT_OF_MEMORY
Definition: error.h:63
HostnameResolver protocol
Name resolution protocol.
Definition: dns_cache.h:100
@ DNS_RR_CLASS_IN
Internet.
Definition: dns_common.h:124
char_t name[]
DnsHeader
Definition: dns_common.h:199
IpAddr ipAddr
IP address.
Definition: dns_cache.h:106
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:297
uint32_t netGenerateRand(void)
Generate a random 32-bit value.
Definition: net_misc.c:922
@ HOST_TYPE_IPV6
Definition: socket.h:218
IP pseudo header.
Definition: ip.h:110
uint16_t id
Identifier used to match queries and responses.
Definition: dns_cache.h:104
@ DNS_RCODE_NOERROR
No error.
Definition: dns_common.h:95
@ ERROR_IN_PROGRESS
Definition: error.h:213
Helper functions for IPv4.
uint16_t port
Port number used by the resolver.
Definition: dns_cache.h:103
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
error_t
Error codes.
Definition: error.h:43
#define DNS_GET_QUESTION(message, offset)
Definition: dns_common.h:63
char_t name[DNS_MAX_NAME_LEN+1]
Domain name.
Definition: dns_cache.h:105
systime_t timestamp
Time stamp to manage entry lifetime.
Definition: dns_cache.h:107
#define DNS_GET_RESOURCE_RECORD(message, offset)
Definition: dns_common.h:64
#define LLMNR_CLIENT_MAX_RETRIES
Definition: llmnr_client.h:51
#define LLMNR_IPV4_MULTICAST_ADDR
Definition: llmnr_common.h:60
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define LLMNR_PORT
Definition: llmnr_common.h:53
error_t udpDetachRxCallback(NetInterface *interface, uint16_t port)
Unregister user callback.
Definition: udp.c:1062
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
error_t udpAttachRxCallback(NetInterface *interface, uint16_t port, UdpRxCallback callback, void *param)
Register user callback.
Definition: udp.c:1021
void netBufferFree(NetBuffer *buffer)
Dispose a multi-part buffer.
Definition: net_mem.c:282
DNS cache entry.
Definition: dns_cache.h:97
@ DNS_RR_TYPE_A
Host address.
Definition: dns_common.h:137
error_t udpSendBuffer(NetInterface *interface, const IpAddr *srcIpAddr, uint16_t srcPort, const IpAddr *destIpAddr, uint16_t destPort, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a UDP datagram.
Definition: udp.c:658
DnsCacheEntry * dnsCreateEntry(void)
Create a new entry in the DNS cache.
Definition: dns_cache.c:103
#define NetTxAncillary
Definition: net_misc.h:36
systime_t maxTimeout
Maximum retransmission timeout.
Definition: dns_cache.h:109
error_t llmnrResolve(NetInterface *interface, const char_t *name, HostType type, IpAddr *ipAddr)
Resolve a host name using LLMNR.
Definition: llmnr_client.c:53
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t length
Definition: tcp.h:368
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
void dnsDumpMessage(const DnsHeader *message, size_t length)
Dump DNS message for debugging purpose.
Definition: dns_debug.c:52
#define MIN(a, b)
Definition: os_port.h:63
NetBuffer * udpAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a UDP packet.
Definition: udp.c:948
size_t length
Definition: ip.h:91
@ HOST_TYPE_IPV4
Definition: socket.h:217
uint16_t udpGetDynamicPort(void)
Get an ephemeral port number.
Definition: udp.c:81
size_t dnsEncodeName(const char_t *src, uint8_t *dest)
Encode a domain name using the DNS name notation.
Definition: dns_common.c:58
const Ipv6Addr LLMNR_IPV6_MULTICAST_ADDR
Definition: llmnr_common.c:45
UdpHeader
Definition: udp.h:85
#define DNS_CACHE_INIT_POLLING_INTERVAL
Definition: dns_cache.h:61
#define LLMNR_MESSAGE_MAX_SIZE
Definition: llmnr_common.h:40
uint32_t systime_t
System time.
#define ntohs(value)
Definition: cpu_endian.h:421
char char_t
Definition: compiler_port.h:48
LLMNR client (Link-Local Multicast Name Resolution)
DnsCacheEntry * dnsFindEntry(NetInterface *interface, const char_t *name, HostType type, HostnameResolver protocol)
Search the DNS cache for a given domain name.
Definition: dns_cache.c:186
Ipv4Addr ipv4Addr
Definition: ip.h:95
#define ipv6CopyAddr(destIpAddr, srcIpAddr)
Definition: ipv6.h:123
#define HTONS(value)
Definition: cpu_endian.h:410
@ DNS_STATE_IN_PROGRESS
Definition: dns_cache.h:86
NetInterface * interface
Underlying network interface.
Definition: dns_cache.h:101
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
#define DNS_CACHE_SIZE
Definition: dns_cache.h:47
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
@ DNS_STATE_RESOLVED
Definition: dns_cache.h:87
error_t netBufferSetLength(NetBuffer *buffer, size_t length)
Adjust the length of a multi-part buffer.
Definition: net_mem.c:322
DnsQuestion
Definition: dns_common.h:210
#define ipv4CopyAddr(destIpAddr, srcIpAddr)
Definition: ipv4.h:155
void osDelayTask(systime_t delay)
Delay routine.
void * netBufferAt(const NetBuffer *buffer, size_t offset, size_t length)
Returns a pointer to a data segment.
Definition: net_mem.c:418
#define LLMNR_CLIENT_INIT_TIMEOUT
Definition: llmnr_client.h:58
Ipv4Addr ipAddr
Definition: ipcp.h:105
DnsCacheEntry dnsCache[DNS_CACHE_SIZE]
Definition: dns_cache.c:51
DnsState state
Entry state.
Definition: dns_cache.h:98
Ipv6Addr ipv6Addr
Definition: ip.h:98
uint_t retransmitCount
Retransmission counter.
Definition: dns_cache.h:110
#define PRIuSIZE
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
DnsResourceRecord
Definition: dns_common.h:224
void llmnrProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param)
Process LLMNR response message.
Definition: llmnr_client.c:350
@ DNS_RR_TYPE_AAAA
IPv6 address.
Definition: dns_common.h:147
Data logging functions for debugging purpose (DNS)
int_t dnsCompareName(const DnsHeader *message, size_t length, size_t pos, const char_t *name, uint_t level)
Compare domain names.
Definition: dns_common.c:242
#define osStrcpy(s1, s2)
Definition: os_port.h:207
#define DNS_CACHE_MAX_POLLING_INTERVAL
Definition: dns_cache.h:68
#define ntohl(value)
Definition: cpu_endian.h:422
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
systime_t osGetSystemTime(void)
Retrieve system time.
Ipv4Addr destIpAddr
Definition: ipcp.h:80