GNUnet  0.17.6
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  */
25 #include "platform.h"
26 #include "gnunet_util_lib.h"
27 
31 #define DNS_RETRANSMIT_DELAY \
32  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
33 
34 
38 struct DnsServer;
39 
40 
45 {
50 
55 
60 
64  void *rc_cls;
65 
70 
75 
79  struct DnsServer *ds_pos;
80 
85 
89  void *request;
90 
94  size_t request_len;
95 };
96 
97 
101 struct DnsServer
102 {
106  struct DnsServer *next;
107 
111  struct DnsServer *prev;
112 
116  struct sockaddr_storage ss;
117 };
118 
119 
124 {
129 
134 
139 
144 
148  unsigned int num_sockets;
149 };
150 
151 
157 static void
159 {
160  if (NULL != rs->dnsout4)
161  {
163  rs->dnsout4 = NULL;
164  }
165  if (NULL != rs->dnsout6)
166  {
168  rs->dnsout6 = NULL;
169  }
170  if (NULL != rs->read_task)
171  {
173  rs->read_task = NULL;
174  }
175  if (NULL != rs->retry_task)
176  {
178  rs->retry_task = NULL;
179  }
180  if (NULL != rs->request)
181  {
182  GNUNET_free (rs->request);
183  rs->request = NULL;
184  }
185 }
186 
187 
194 static struct GNUNET_NETWORK_Handle *
196 {
197  struct sockaddr_in a4;
198  struct sockaddr_in6 a6;
199  struct sockaddr *sa;
200  socklen_t alen;
201  struct GNUNET_NETWORK_Handle *ret;
202 
203  ret = GNUNET_NETWORK_socket_create (af, SOCK_DGRAM, 0);
204  if (NULL == ret)
205  return NULL;
206  switch (af)
207  {
208  case AF_INET:
209  memset (&a4, 0, alen = sizeof(struct sockaddr_in));
210  sa = (struct sockaddr *) &a4;
211  break;
212 
213  case AF_INET6:
214  memset (&a6, 0, alen = sizeof(struct sockaddr_in6));
215  sa = (struct sockaddr *) &a6;
216  break;
217 
218  default:
219  GNUNET_break (0);
221  return NULL;
222  }
223  sa->sa_family = af;
224  if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret, sa, alen))
225  {
227  _ ("Could not bind to any port: %s\n"),
228  strerror (errno));
230  return NULL;
231  }
232  return ret;
233 }
234 
235 
243 static struct GNUNET_DNSSTUB_RequestSocket *
245 {
246  struct GNUNET_DNSSTUB_RequestSocket *rs;
247 
248  for (unsigned int i = 0; i < 256; i++)
249  {
251  ctx->num_sockets)];
252  if (NULL == rs->rc)
253  break;
254  }
255  if (NULL != rs->rc)
256  {
257  /* signal "failure" */
258  rs->rc (rs->rc_cls, NULL, 0);
259  rs->rc = NULL;
260  }
261  if (NULL != rs->read_task)
262  {
264  rs->read_task = NULL;
265  }
266  if (NULL != rs->retry_task)
267  {
269  rs->retry_task = NULL;
270  }
271  if (NULL != rs->request)
272  {
273  GNUNET_free (rs->request);
274  rs->request = NULL;
275  }
276  rs->ctx = ctx;
277  return rs;
278 }
279 
280 
289 static int
291  struct GNUNET_NETWORK_Handle *dnsout)
292 {
293  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
294  ssize_t r;
295  int len;
296 
297  if (0 != ioctl (GNUNET_NETWORK_get_fd (dnsout), FIONREAD, &len))
298  {
299  /* conservative choice: */
300  len = UINT16_MAX;
301  }
302 
303  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving %d byte DNS reply\n", len);
304  {
305  unsigned char buf[len] GNUNET_ALIGN;
306  int found;
307  struct sockaddr_storage addr;
308  socklen_t addrlen;
309  struct GNUNET_TUN_DnsHeader *dns;
310 
311  addrlen = sizeof(addr);
312  memset (&addr, 0, sizeof(addr));
313  r = GNUNET_NETWORK_socket_recvfrom (dnsout,
314  buf,
315  sizeof(buf),
316  (struct sockaddr *) &addr,
317  &addrlen);
318  if (-1 == r)
319  {
322  return GNUNET_SYSERR;
323  }
324  found = GNUNET_NO;
325  for (struct DnsServer *ds = ctx->dns_head; NULL != ds; ds = ds->next)
326  {
327  if (ds->ss.ss_family != addr.ss_family)
328  continue;
329  if (addr.ss_family == AF_INET)
330  {
331  struct sockaddr_in *v4 = (struct sockaddr_in *) &addr;
332  struct sockaddr_in *ds_v4 = (struct sockaddr_in *) &ds->ss;
333 
334 
335  if ((0 == memcmp (&v4->sin_addr,
336  &ds_v4->sin_addr,
337  sizeof(struct sockaddr_in))) &&
338  (v4->sin_port == ds_v4->sin_port))
339  {
340  found = GNUNET_YES;
341  break;
342  }
343  }
344  else
345  {
346  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *) &addr;
347  struct sockaddr_in6 *ds_v6 = (struct sockaddr_in6 *) &ds->ss;
348 
349  if (0 == memcmp (&v6->sin6_addr,
350  &ds_v6->sin6_addr,
351  sizeof (v6->sin6_addr)) &&
352  (v6->sin6_port == ds_v6->sin6_port))
353  {
354  found = GNUNET_YES;
355  break;
356  }
357 
358  }
359  }
360  if (GNUNET_NO == found)
361  {
363  "Received DNS response from server we never asked (ignored)\n");
364 
365  return GNUNET_NO;
366  }
367  if (sizeof(struct GNUNET_TUN_DnsHeader) > (size_t) r)
368  {
370  _ ("Received DNS response that is too small (%u bytes)\n"),
371  (unsigned int) r);
372  return GNUNET_NO;
373  }
374  dns = (struct GNUNET_TUN_DnsHeader *) buf;
375  if (NULL == rs->rc)
376  {
378  "Request timeout or cancelled; ignoring reply\n");
379  return GNUNET_NO;
380  }
381  rs->rc (rs->rc_cls, dns, r);
382  }
383  return GNUNET_OK;
384 }
385 
386 
392 static void
393 read_response (void *cls);
394 
395 
401 static void
403 {
404  struct GNUNET_NETWORK_FDSet *rset;
405 
406  if (NULL != rs->read_task)
408  rset = GNUNET_NETWORK_fdset_create ();
409  if (NULL != rs->dnsout4)
410  GNUNET_NETWORK_fdset_set (rset, rs->dnsout4);
411  if (NULL != rs->dnsout6)
412  GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
413  rs->read_task =
416  rset,
417  NULL,
418  &read_response,
419  rs);
421 }
422 
423 
429 static void
430 read_response (void *cls)
431 {
432  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
433  const struct GNUNET_SCHEDULER_TaskContext *tc;
434 
435  rs->read_task = NULL;
437  /* read and process ready sockets */
438  if ((NULL != rs->dnsout4) &&
440  (GNUNET_SYSERR == do_dns_read (rs, rs->dnsout4)))
441  rs->dnsout4 = NULL;
442  if ((NULL != rs->dnsout6) &&
444  (GNUNET_SYSERR == do_dns_read (rs, rs->dnsout6)))
445  rs->dnsout6 = NULL;
446  /* re-schedule read task */
447  schedule_read (rs);
448 }
449 
450 
457 static void
458 transmit_query (void *cls)
459 {
460  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
461  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
462  const struct sockaddr *sa;
463  socklen_t salen;
464  struct DnsServer *ds;
465  struct GNUNET_NETWORK_Handle *dnsout;
466 
467  rs->retry_task =
469  ds = rs->ds_pos;
470  rs->ds_pos = ds->next;
471  if (NULL == rs->ds_pos)
472  rs->ds_pos = ctx->dns_head;
473  GNUNET_assert (NULL != ds);
474  dnsout = NULL;
475  switch (ds->ss.ss_family)
476  {
477  case AF_INET:
478  if (NULL == rs->dnsout4)
479  rs->dnsout4 = open_socket (AF_INET);
480  dnsout = rs->dnsout4;
481  sa = (const struct sockaddr *) &ds->ss;
482  salen = sizeof(struct sockaddr_in);
483  break;
484 
485  case AF_INET6:
486  if (NULL == rs->dnsout6)
487  rs->dnsout6 = open_socket (AF_INET6);
488  dnsout = rs->dnsout6;
489  sa = (const struct sockaddr *) &ds->ss;
490  salen = sizeof(struct sockaddr_in6);
491  break;
492 
493  default:
494  return;
495  }
496  if (NULL == dnsout)
497  {
499  "Unable to use configure DNS server, skipping\n");
500  return;
501  }
503  rs->request,
504  rs->request_len,
505  sa,
506  salen))
508  _ ("Failed to send DNS request to %s: %s\n"),
509  GNUNET_a2s (sa, salen),
510  strerror (errno));
511  else
513  _ ("Sent DNS request to %s\n"),
514  GNUNET_a2s (sa, salen));
515  schedule_read (rs);
516 }
517 
518 
531  const void *request,
532  size_t request_len,
534  void *rc_cls)
535 {
536  struct GNUNET_DNSSTUB_RequestSocket *rs;
537 
538  if (NULL == ctx->dns_head)
539  {
541  "No DNS server configured for resolution\n");
542  return NULL;
543  }
544  if (NULL == (rs = get_request_socket (ctx)))
545  {
547  "No request socket available for DNS resolution\n");
548  return NULL;
549  }
550  rs->ds_pos = ctx->dns_head;
551  rs->rc = rc;
552  rs->rc_cls = rc_cls;
554  rs->request_len = request_len;
556  return rs;
557 }
558 
559 
565 void
567 {
568  rs->rc = NULL;
569  if (NULL != rs->retry_task)
570  {
572  rs->retry_task = NULL;
573  }
574  if (NULL != rs->read_task)
575  {
577  rs->read_task = NULL;
578  }
579 }
580 
581 
589 struct GNUNET_DNSSTUB_Context *
591 {
592  struct GNUNET_DNSSTUB_Context *ctx;
593 
594  if (0 == num_sockets)
595  {
596  GNUNET_break (0);
597  return NULL;
598  }
601  ctx->sockets =
604  return ctx;
605 }
606 
607 
616 int
618  const char *dns_ip)
619 {
620  struct DnsServer *ds;
621  struct in_addr i4;
622  struct in6_addr i6;
623 
624  ds = GNUNET_new (struct DnsServer);
625  if (1 == inet_pton (AF_INET, dns_ip, &i4))
626  {
627  struct sockaddr_in *s4 = (struct sockaddr_in *) &ds->ss;
628 
629  s4->sin_family = AF_INET;
630  s4->sin_port = htons (53);
631  s4->sin_addr = i4;
632 #if HAVE_SOCKADDR_IN_SIN_LEN
633  s4->sin_len = (u_char) sizeof(struct sockaddr_in);
634 #endif
635  }
636  else if (1 == inet_pton (AF_INET6, dns_ip, &i6))
637  {
638  struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) &ds->ss;
639 
640  s6->sin6_family = AF_INET6;
641  s6->sin6_port = htons (53);
642  s6->sin6_addr = i6;
643 #if HAVE_SOCKADDR_IN_SIN_LEN
644  s6->sin6_len = (u_char) sizeof(struct sockaddr_in6);
645 #endif
646  }
647  else
648  {
650  "Malformed IP address `%s' for DNS server\n",
651  dns_ip);
652  GNUNET_free (ds);
653  return GNUNET_SYSERR;
654  }
656  return GNUNET_OK;
657 }
658 
659 
668 int
670  const struct sockaddr *sa)
671 {
672  struct DnsServer *ds;
673 
674  ds = GNUNET_new (struct DnsServer);
675  switch (sa->sa_family)
676  {
677  case AF_INET :
678  GNUNET_memcpy (&ds->ss, sa, sizeof(struct sockaddr_in));
679  break;
680 
681  case AF_INET6:
682  GNUNET_memcpy (&ds->ss, sa, sizeof(struct sockaddr_in6));
683  break;
684 
685  default:
686  GNUNET_break (0);
687  GNUNET_free (ds);
688  return GNUNET_SYSERR;
689  }
691  return GNUNET_OK;
692 }
693 
694 
702 void
704  struct GNUNET_TIME_Relative retry_freq)
705 {
706  ctx->retry_freq = retry_freq;
707 }
708 
709 
715 void
717 {
718  struct DnsServer *ds;
719 
720  while (NULL != (ds = ctx->dns_head))
721  {
723  GNUNET_free (ds);
724  }
725  for (unsigned int i = 0; i < ctx->num_sockets; i++)
726  cleanup_rs (&ctx->sockets[i]);
728  GNUNET_free (ctx);
729 }
730 
731 
732 /* 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:458
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:244
static void read_response(void *cls)
Read a DNS response from the (unhindered) UDP-Socket.
Definition: dnsstub.c:430
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:290
static void schedule_read(struct GNUNET_DNSSTUB_RequestSocket *rs)
Schedule read_response() task for rs.
Definition: dnsstub.c:402
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:158
static struct GNUNET_NETWORK_Handle * open_socket(int af)
Open source port for sending DNS requests.
Definition: dnsstub.c:195
#define DNS_RETRANSMIT_DELAY
Timeout for retrying DNS queries.
Definition: dnsstub.c:31
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:41
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:617
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:716
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:703
struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start(unsigned int num_sockets)
Start a DNS stub resolver.
Definition: dnsstub.c:590
void GNUNET_DNSSTUB_resolve_cancel(struct GNUNET_DNSSTUB_RequestSocket *rs)
Cancel DNS resolution.
Definition: dnsstub.c:566
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:530
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:669
#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
Definition: gnunet_common.h:99
@ GNUNET_YES
@ GNUNET_NO
Definition: gnunet_common.h:98
@ GNUNET_SYSERR
Definition: gnunet_common.h:97
#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:1193
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:1209
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
Definition: network.c:1023
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:702
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
Definition: network.c:855
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:954
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:794
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:972
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:1281
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:1826
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
Definition: scheduler.c:737
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:957
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:1254
#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:423
DNS Server used for resolution.
Definition: dnsstub.c:102
struct DnsServer * next
Kept in a DLL.
Definition: dnsstub.c:106
struct DnsServer * prev
Kept in a DLL.
Definition: dnsstub.c:111
struct sockaddr_storage ss
IP address of the DNS resolver.
Definition: dnsstub.c:116
Handle to the stub resolver.
Definition: dnsstub.c:124
struct DnsServer * dns_tail
DLL of DNS resolvers we use.
Definition: dnsstub.c:138
unsigned int num_sockets
Length of sockets array.
Definition: dnsstub.c:148
struct GNUNET_DNSSTUB_RequestSocket * sockets
Array of all open sockets for DNS requests.
Definition: dnsstub.c:128
struct DnsServer * dns_head
DLL of DNS resolvers we use.
Definition: dnsstub.c:133
struct GNUNET_TIME_Relative retry_freq
How frequently do we retry requests?
Definition: dnsstub.c:143
UDP socket we are using for sending DNS requests to the Internet.
Definition: dnsstub.c:45
void * request
Query we sent to addr.
Definition: dnsstub.c:89
struct GNUNET_DNSSTUB_Context * ctx
Context this request executes in.
Definition: dnsstub.c:84
struct GNUNET_NETWORK_Handle * dnsout4
UDP socket we use for this request for IPv4.
Definition: dnsstub.c:49
struct GNUNET_SCHEDULER_Task * read_task
Task for reading from dnsout4 and dnsout6.
Definition: dnsstub.c:69
GNUNET_DNSSTUB_ResultCallback rc
Function to call with result.
Definition: dnsstub.c:59
struct GNUNET_SCHEDULER_Task * retry_task
Task for retrying transmission of the query.
Definition: dnsstub.c:74
struct GNUNET_NETWORK_Handle * dnsout6
UDP socket we use for this request for IPv6.
Definition: dnsstub.c:54
size_t request_len
Number of bytes in request.
Definition: dnsstub.c:94
void * rc_cls
Closure for rc.
Definition: dnsstub.c:64
struct DnsServer * ds_pos
Next address we sent the DNS request to.
Definition: dnsstub.c:79
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:135
Time for relative time used by GNUnet, in microseconds.