GNUnet  0.19.2
dnsstub.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012, 2018 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 
32 #define DNS_RETRANSMIT_DELAY \
33  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
34 
35 
39 struct DnsServer;
40 
41 
46 {
51 
56 
61 
65  void *rc_cls;
66 
71 
76 
80  struct DnsServer *ds_pos;
81 
86 
90  void *request;
91 
95  size_t request_len;
96 };
97 
98 
102 struct DnsServer
103 {
107  struct DnsServer *next;
108 
112  struct DnsServer *prev;
113 
117  struct sockaddr_storage ss;
118 };
119 
120 
125 {
130 
135 
140 
145 
149  unsigned int num_sockets;
150 };
151 
152 
158 static void
160 {
161  if (NULL != rs->dnsout4)
162  {
164  rs->dnsout4 = NULL;
165  }
166  if (NULL != rs->dnsout6)
167  {
169  rs->dnsout6 = NULL;
170  }
171  if (NULL != rs->read_task)
172  {
174  rs->read_task = NULL;
175  }
176  if (NULL != rs->retry_task)
177  {
179  rs->retry_task = NULL;
180  }
181  if (NULL != rs->request)
182  {
183  GNUNET_free (rs->request);
184  rs->request = NULL;
185  }
186 }
187 
188 
195 static struct GNUNET_NETWORK_Handle *
197 {
198  struct sockaddr_in a4;
199  struct sockaddr_in6 a6;
200  struct sockaddr *sa;
201  socklen_t alen;
202  struct GNUNET_NETWORK_Handle *ret;
203 
204  ret = GNUNET_NETWORK_socket_create (af, SOCK_DGRAM, 0);
205  if (NULL == ret)
206  return NULL;
207  switch (af)
208  {
209  case AF_INET:
210  memset (&a4, 0, alen = sizeof(struct sockaddr_in));
211  sa = (struct sockaddr *) &a4;
212  break;
213 
214  case AF_INET6:
215  memset (&a6, 0, alen = sizeof(struct sockaddr_in6));
216  sa = (struct sockaddr *) &a6;
217  break;
218 
219  default:
220  GNUNET_break (0);
222  return NULL;
223  }
224  sa->sa_family = af;
225  if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret, sa, alen))
226  {
228  _ ("Could not bind to any port: %s\n"),
229  strerror (errno));
231  return NULL;
232  }
233  return ret;
234 }
235 
236 
244 static struct GNUNET_DNSSTUB_RequestSocket *
246 {
247  struct GNUNET_DNSSTUB_RequestSocket *rs;
248 
249  for (unsigned int i = 0; i < 256; i++)
250  {
252  ctx->num_sockets)];
253  if (NULL == rs->rc)
254  break;
255  }
256  if (NULL != rs->rc)
257  {
258  /* signal "failure" */
259  rs->rc (rs->rc_cls, NULL, 0);
260  rs->rc = NULL;
261  }
262  if (NULL != rs->read_task)
263  {
265  rs->read_task = NULL;
266  }
267  if (NULL != rs->retry_task)
268  {
270  rs->retry_task = NULL;
271  }
272  if (NULL != rs->request)
273  {
274  GNUNET_free (rs->request);
275  rs->request = NULL;
276  }
277  rs->ctx = ctx;
278  return rs;
279 }
280 
281 
290 static int
292  struct GNUNET_NETWORK_Handle *dnsout)
293 {
294  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
295  ssize_t r;
296  int len;
297 
298  if (0 != ioctl (GNUNET_NETWORK_get_fd (dnsout), FIONREAD, &len))
299  {
300  /* conservative choice: */
301  len = UINT16_MAX;
302  }
303 
304  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving %d byte DNS reply\n", len);
305  {
306  unsigned char buf[len] GNUNET_ALIGN;
307  int found;
308  struct sockaddr_storage addr;
309  socklen_t addrlen;
310  struct GNUNET_TUN_DnsHeader *dns;
311 
312  addrlen = sizeof(addr);
313  memset (&addr, 0, sizeof(addr));
314  r = GNUNET_NETWORK_socket_recvfrom (dnsout,
315  buf,
316  sizeof(buf),
317  (struct sockaddr *) &addr,
318  &addrlen);
319  if (-1 == r)
320  {
323  return GNUNET_SYSERR;
324  }
325  found = GNUNET_NO;
326  for (struct DnsServer *ds = ctx->dns_head; NULL != ds; ds = ds->next)
327  {
328  if (ds->ss.ss_family != addr.ss_family)
329  continue;
330  if (addr.ss_family == AF_INET)
331  {
332  struct sockaddr_in *v4 = (struct sockaddr_in *) &addr;
333  struct sockaddr_in *ds_v4 = (struct sockaddr_in *) &ds->ss;
334 
335 
336  if ((0 == memcmp (&v4->sin_addr,
337  &ds_v4->sin_addr,
338  sizeof(struct sockaddr_in))) &&
339  (v4->sin_port == ds_v4->sin_port))
340  {
341  found = GNUNET_YES;
342  break;
343  }
344  }
345  else
346  {
347  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *) &addr;
348  struct sockaddr_in6 *ds_v6 = (struct sockaddr_in6 *) &ds->ss;
349 
350  if (0 == memcmp (&v6->sin6_addr,
351  &ds_v6->sin6_addr,
352  sizeof (v6->sin6_addr)) &&
353  (v6->sin6_port == ds_v6->sin6_port))
354  {
355  found = GNUNET_YES;
356  break;
357  }
358 
359  }
360  }
361  if (GNUNET_NO == found)
362  {
364  "Received DNS response from server we never asked (ignored)\n");
365 
366  return GNUNET_NO;
367  }
368  if (sizeof(struct GNUNET_TUN_DnsHeader) > (size_t) r)
369  {
371  _ ("Received DNS response that is too small (%u bytes)\n"),
372  (unsigned int) r);
373  return GNUNET_NO;
374  }
375  dns = (struct GNUNET_TUN_DnsHeader *) buf;
376  if (NULL == rs->rc)
377  {
379  "Request timeout or cancelled; ignoring reply\n");
380  return GNUNET_NO;
381  }
382  rs->rc (rs->rc_cls, dns, r);
383  }
384  return GNUNET_OK;
385 }
386 
387 
393 static void
394 read_response (void *cls);
395 
396 
402 static void
404 {
405  struct GNUNET_NETWORK_FDSet *rset;
406 
407  if (NULL != rs->read_task)
409  rset = GNUNET_NETWORK_fdset_create ();
410  if (NULL != rs->dnsout4)
411  GNUNET_NETWORK_fdset_set (rset, rs->dnsout4);
412  if (NULL != rs->dnsout6)
413  GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
414  rs->read_task =
417  rset,
418  NULL,
419  &read_response,
420  rs);
422 }
423 
424 
425 static void
426 read_response (void *cls)
427 {
428  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
429  const struct GNUNET_SCHEDULER_TaskContext *tc;
430 
431  rs->read_task = NULL;
433  /* read and process ready sockets */
434  if ((NULL != rs->dnsout4) &&
436  (GNUNET_SYSERR == do_dns_read (rs, rs->dnsout4)))
437  rs->dnsout4 = NULL;
438  if ((NULL != rs->dnsout6) &&
440  (GNUNET_SYSERR == do_dns_read (rs, rs->dnsout6)))
441  rs->dnsout6 = NULL;
442  /* re-schedule read task */
443  schedule_read (rs);
444 }
445 
446 
453 static void
454 transmit_query (void *cls)
455 {
456  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
457  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
458  const struct sockaddr *sa;
459  socklen_t salen;
460  struct DnsServer *ds;
461  struct GNUNET_NETWORK_Handle *dnsout;
462 
463  rs->retry_task =
465  ds = rs->ds_pos;
466  rs->ds_pos = ds->next;
467  if (NULL == rs->ds_pos)
468  rs->ds_pos = ctx->dns_head;
469  GNUNET_assert (NULL != ds);
470  dnsout = NULL;
471  switch (ds->ss.ss_family)
472  {
473  case AF_INET:
474  if (NULL == rs->dnsout4)
475  rs->dnsout4 = open_socket (AF_INET);
476  dnsout = rs->dnsout4;
477  sa = (const struct sockaddr *) &ds->ss;
478  salen = sizeof(struct sockaddr_in);
479  break;
480 
481  case AF_INET6:
482  if (NULL == rs->dnsout6)
483  rs->dnsout6 = open_socket (AF_INET6);
484  dnsout = rs->dnsout6;
485  sa = (const struct sockaddr *) &ds->ss;
486  salen = sizeof(struct sockaddr_in6);
487  break;
488 
489  default:
490  return;
491  }
492  if (NULL == dnsout)
493  {
495  "Unable to use configure DNS server, skipping\n");
496  return;
497  }
499  rs->request,
500  rs->request_len,
501  sa,
502  salen))
504  _ ("Failed to send DNS request to %s: %s\n"),
505  GNUNET_a2s (sa, salen),
506  strerror (errno));
507  else
509  _ ("Sent DNS request to %s\n"),
510  GNUNET_a2s (sa, salen));
511  schedule_read (rs);
512 }
513 
514 
527  const void *request,
528  size_t request_len,
530  void *rc_cls)
531 {
532  struct GNUNET_DNSSTUB_RequestSocket *rs;
533 
534  if (NULL == ctx->dns_head)
535  {
537  "No DNS server configured for resolution\n");
538  return NULL;
539  }
540  if (NULL == (rs = get_request_socket (ctx)))
541  {
543  "No request socket available for DNS resolution\n");
544  return NULL;
545  }
546  rs->ds_pos = ctx->dns_head;
547  rs->rc = rc;
548  rs->rc_cls = rc_cls;
550  rs->request_len = request_len;
552  return rs;
553 }
554 
555 
561 void
563 {
564  rs->rc = NULL;
565  if (NULL != rs->retry_task)
566  {
568  rs->retry_task = NULL;
569  }
570  if (NULL != rs->read_task)
571  {
573  rs->read_task = NULL;
574  }
575 }
576 
577 
585 struct GNUNET_DNSSTUB_Context *
587 {
588  struct GNUNET_DNSSTUB_Context *ctx;
589 
590  if (0 == num_sockets)
591  {
592  GNUNET_break (0);
593  return NULL;
594  }
597  ctx->sockets =
600  return ctx;
601 }
602 
603 
612 int
614  const char *dns_ip)
615 {
616  struct DnsServer *ds;
617  struct in_addr i4;
618  struct in6_addr i6;
619 
620  ds = GNUNET_new (struct DnsServer);
621  if (1 == inet_pton (AF_INET, dns_ip, &i4))
622  {
623  struct sockaddr_in *s4 = (struct sockaddr_in *) &ds->ss;
624 
625  s4->sin_family = AF_INET;
626  s4->sin_port = htons (53);
627  s4->sin_addr = i4;
628 #if HAVE_SOCKADDR_IN_SIN_LEN
629  s4->sin_len = (u_char) sizeof(struct sockaddr_in);
630 #endif
631  }
632  else if (1 == inet_pton (AF_INET6, dns_ip, &i6))
633  {
634  struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) &ds->ss;
635 
636  s6->sin6_family = AF_INET6;
637  s6->sin6_port = htons (53);
638  s6->sin6_addr = i6;
639 #if HAVE_SOCKADDR_IN_SIN_LEN
640  s6->sin6_len = (u_char) sizeof(struct sockaddr_in6);
641 #endif
642  }
643  else
644  {
646  "Malformed IP address `%s' for DNS server\n",
647  dns_ip);
648  GNUNET_free (ds);
649  return GNUNET_SYSERR;
650  }
652  return GNUNET_OK;
653 }
654 
655 
664 int
666  const struct sockaddr *sa)
667 {
668  struct DnsServer *ds;
669 
670  ds = GNUNET_new (struct DnsServer);
671  switch (sa->sa_family)
672  {
673  case AF_INET :
674  GNUNET_memcpy (&ds->ss, sa, sizeof(struct sockaddr_in));
675  break;
676 
677  case AF_INET6:
678  GNUNET_memcpy (&ds->ss, sa, sizeof(struct sockaddr_in6));
679  break;
680 
681  default:
682  GNUNET_break (0);
683  GNUNET_free (ds);
684  return GNUNET_SYSERR;
685  }
687  return GNUNET_OK;
688 }
689 
690 
691 void
693  struct GNUNET_TIME_Relative retry_freq)
694 {
695  ctx->retry_freq = retry_freq;
696 }
697 
698 
704 void
706 {
707  struct DnsServer *ds;
708 
709  while (NULL != (ds = ctx->dns_head))
710  {
712  GNUNET_free (ds);
713  }
714  for (unsigned int i = 0; i < ctx->num_sockets; i++)
715  cleanup_rs (&ctx->sockets[i]);
717  GNUNET_free (ctx);
718 }
719 
720 
721 /* end of dnsstub.c */
static void transmit_query(void *cls)
Task to (re)transmit the DNS query, possibly repeatedly until we succeed.
Definition: dnsstub.c:454
static struct GNUNET_DNSSTUB_RequestSocket * get_request_socket(struct GNUNET_DNSSTUB_Context *ctx)
Get a socket of the specified address family to send out a UDP DNS request to the Internet.
Definition: dnsstub.c:245
static void read_response(void *cls)
Read a DNS response from the (unhindered) UDP-Socket.
Definition: dnsstub.c:426
static int do_dns_read(struct GNUNET_DNSSTUB_RequestSocket *rs, struct GNUNET_NETWORK_Handle *dnsout)
Actually do the reading of a DNS packet from our UDP socket and see if we have a valid,...
Definition: dnsstub.c:291
static void schedule_read(struct GNUNET_DNSSTUB_RequestSocket *rs)
Schedule read_response() task for rs.
Definition: dnsstub.c:403
static void cleanup_rs(struct GNUNET_DNSSTUB_RequestSocket *rs)
We're done with a struct GNUNET_DNSSTUB_RequestSocket, close it for now.
Definition: dnsstub.c:159
static struct GNUNET_NETWORK_Handle * open_socket(int af)
Open source port for sending DNS requests.
Definition: dnsstub.c:196
#define DNS_RETRANSMIT_DELAY
Timeout for retrying DNS queries.
Definition: dnsstub.c:32
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static char * dns_ip
IP of DNS server.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
static struct GNUNET_FS_DirScanner * ds
Handle to the directory scanner (for recursive insertions).
static char buf[2048]
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:40
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
@ GNUNET_CRYPTO_QUALITY_NONCE
Randomness for IVs etc.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
int GNUNET_DNSSTUB_add_dns_ip(struct GNUNET_DNSSTUB_Context *ctx, const char *dns_ip)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:613
void(* GNUNET_DNSSTUB_ResultCallback)(void *cls, const struct GNUNET_TUN_DnsHeader *dns, size_t dns_len)
Function called with the result of a DNS resolution.
void GNUNET_DNSSTUB_stop(struct GNUNET_DNSSTUB_Context *ctx)
Cleanup DNSSTUB resolver.
Definition: dnsstub.c:705
void GNUNET_DNSSTUB_set_retry(struct GNUNET_DNSSTUB_Context *ctx, struct GNUNET_TIME_Relative retry_freq)
How long should we try requests before timing out? Only effective for requests issued after this call...
Definition: dnsstub.c:692
struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start(unsigned int num_sockets)
Start a DNS stub resolver.
Definition: dnsstub.c:586
void GNUNET_DNSSTUB_resolve_cancel(struct GNUNET_DNSSTUB_RequestSocket *rs)
Cancel DNS resolution.
Definition: dnsstub.c:562
struct GNUNET_DNSSTUB_RequestSocket * GNUNET_DNSSTUB_resolve(struct GNUNET_DNSSTUB_Context *ctx, const void *request, size_t request_len, GNUNET_DNSSTUB_ResultCallback rc, void *rc_cls)
Perform DNS resolution using our default IP from init.
Definition: dnsstub.c:526
int GNUNET_DNSSTUB_add_dns_sa(struct GNUNET_DNSSTUB_Context *ctx, const struct sockaddr *sa)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:665
#define GNUNET_log(kind,...)
#define GNUNET_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_SCHEDULER_PRIORITY_DEFAULT
Run with the default priority (normal P2P operations).
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
Definition: network.c:1170
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
Definition: network.c:508
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
Definition: network.c:1186
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
Definition: network.c:1000
ssize_t GNUNET_NETWORK_socket_recvfrom(const struct GNUNET_NETWORK_Handle *desc, void *buffer, size_t length, struct sockaddr *src_addr, socklen_t *addrlen)
Read data from a socket (always non-blocking).
Definition: network.c:687
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
Definition: network.c:832
void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds, const struct GNUNET_NETWORK_Handle *desc)
Add a socket to the FD set.
Definition: network.c:931
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
Definition: network.c:439
ssize_t GNUNET_NETWORK_socket_sendto(const struct GNUNET_NETWORK_Handle *desc, const void *message, size_t length, const struct sockaddr *dest_addr, socklen_t dest_len)
Send data to a particular destination (always non-blocking).
Definition: network.c:771
int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds, const struct GNUNET_NETWORK_Handle *desc)
Check whether a socket is part of the fd set.
Definition: network.c:949
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1268
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select(enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when any of the specified file descriptor set...
Definition: scheduler.c:1799
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
Definition: scheduler.c:724
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:944
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1241
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
Definition: scheduler.c:424
DNS Server used for resolution.
Definition: dnsstub.c:103
struct DnsServer * next
Kept in a DLL.
Definition: dnsstub.c:107
struct DnsServer * prev
Kept in a DLL.
Definition: dnsstub.c:112
struct sockaddr_storage ss
IP address of the DNS resolver.
Definition: dnsstub.c:117
Handle to the stub resolver.
Definition: dnsstub.c:125
struct DnsServer * dns_tail
DLL of DNS resolvers we use.
Definition: dnsstub.c:139
unsigned int num_sockets
Length of sockets array.
Definition: dnsstub.c:149
struct GNUNET_DNSSTUB_RequestSocket * sockets
Array of all open sockets for DNS requests.
Definition: dnsstub.c:129
struct DnsServer * dns_head
DLL of DNS resolvers we use.
Definition: dnsstub.c:134
struct GNUNET_TIME_Relative retry_freq
How frequently do we retry requests?
Definition: dnsstub.c:144
UDP socket we are using for sending DNS requests to the Internet.
Definition: dnsstub.c:46
void * request
Query we sent to addr.
Definition: dnsstub.c:90
struct GNUNET_DNSSTUB_Context * ctx
Context this request executes in.
Definition: dnsstub.c:85
struct GNUNET_NETWORK_Handle * dnsout4
UDP socket we use for this request for IPv4.
Definition: dnsstub.c:50
struct GNUNET_SCHEDULER_Task * read_task
Task for reading from dnsout4 and dnsout6.
Definition: dnsstub.c:70
GNUNET_DNSSTUB_ResultCallback rc
Function to call with result.
Definition: dnsstub.c:60
struct GNUNET_SCHEDULER_Task * retry_task
Task for retrying transmission of the query.
Definition: dnsstub.c:75
struct GNUNET_NETWORK_Handle * dnsout6
UDP socket we use for this request for IPv6.
Definition: dnsstub.c:55
size_t request_len
Number of bytes in request.
Definition: dnsstub.c:95
void * rc_cls
Closure for rc.
Definition: dnsstub.c:65
struct DnsServer * ds_pos
Next address we sent the DNS request to.
Definition: dnsstub.c:80
collection of IO descriptors
handle to a socket
Definition: network.c:53
int af
Address family / domain.
Definition: network.c:59
Context information passed to each scheduler task.
const struct GNUNET_NETWORK_FDSet * read_ready
Set of file descriptors ready for reading; note that additional bits may be set that were not in the ...
Entry in list of pending tasks.
Definition: scheduler.c:136
Time for relative time used by GNUnet, in microseconds.