Commit Graph
89 Commits
Author SHA1 Message Date
Yang Tse 27aa165e9c avoid use of alloca() 2009-04-22 10:25:28 +00:00
Yang Tse 1509409fe1 Moved potential inclusion of system's malloc.h and memory.h header files to
setup_once.h.  Inclusion of each header file is based on the definition of
NEED_MALLOC_H and NEED_MEMORY_H respectively.
2009-04-21 10:26:58 +00:00
Daniel Stenberg f61fa37f40 Gregor Jasny provided the patch that introduces ares_set_socket_callback(),
and I edited it to also get duped by ares_dup().
2008-12-04 12:53:03 +00:00
Daniel Stenberg e61d4b9e21 Introduce ares_dup(3) and new thoughts about API/ABI and how to move forwards.
Also discussed on the ml.
2008-12-03 09:59:50 +00:00
Daniel Stenberg 7ff288f0b9 minor indent fix 2008-12-01 22:36:39 +00:00
Daniel Stenberg f31add0695 Convert the public config struct to the same binary size/construct as in the
latest releases to remain ABI compatible.
2008-12-01 19:06:24 +00:00
Dan Fandrich 9c51eb28fc Make use of gethostname() conditional on it being available 2008-11-28 22:41:14 +00:00
Yang Tse aa1534eb20 In preparation for the upcomming IPv6 nameservers patch, the internal
ares_addr union is now changed into an internal struct which also holds
the address family.
2008-11-25 16:26:58 +00:00
Daniel Stenberg acf5ca090a use unsigned short better intead of mixing with ints to prevent compiler
warnings
2008-11-20 07:50:48 +00:00
Daniel Stenberg 1a1b4eb4f2 - Carlo Contavalli added support for the glibc "rotate" option, as documented
in man resolv.conf:

  causes round robin selection of nameservers from among those listed.  This
  has the effect of spreading the query load among all listed servers, rather
  than having all clients try the first listed server first every time.

  You can enable it with ARES_OPT_ROTATE
2008-11-01 18:35:19 +00:00
Yang Tse f214b583f5 adjust inclusion of "nameser.h" 2008-09-17 01:02:57 +00:00
Yang Tse 507c529dc0 code cleanup 2008-09-16 18:43:25 +00:00
Yang Tse f2582d6949 include header file only when available 2008-09-15 17:14:29 +00:00
Yang Tse 2cb5cbba34 move inclusion of ares_private.h last 2008-09-11 03:46:47 +00:00
Yang Tse f33bd94c05 remove unnecessary typecasting of malloc() 2008-09-06 05:29:05 +00:00
Daniel Stenberg 3f1bde7664 - Fix by Tofu Linden:
The symptom:
  * Users (usually, but not always) on 2-Wire routers and the Comcast service
  and a wired connection to their router would find that the second and
  subsequent DNS lookups from fresh processes using c-ares to resolve the same
  address would cause the process to never see a reply (it keeps polling for
  around 1m15s before giving up).

  The repro:
  * On such a machine (and yeah, it took us a lot of QA to find the systems
  that reproduce such a specific problem!), do 'ahost www.secondlife.com',
  then do it again.  The first process's lookup will work, subsequent lookups
  will time-out and fail.

  The cause:
  * init_id_key() was calling randomize_key() *before* it initialized
  key->state, meaning that the randomness generated by randomize_key() is
  immediately overwritten with deterministic values. (/dev/urandom was also
  being read incorrectly in the c-ares version we were using, but this was
  fixed in a later version.)
  * This makes the stream of generated query-IDs from any new c-ares process
  be an identical and predictable sequence of IDs.
  * This makes the 2-Wire's default built-in DNS server detect these queries
  as probable-duplicates and (erroneously) not respond at all.
2008-08-04 20:23:12 +00:00
Daniel Stenberg 705c749aa1 - As was pointed out to me by Andreas Schuldei, the MAXHOSTNAMELEN define is
not posix or anything and thus c-ares failed to build on hurd (and possibly
  elsewhere). The define was also somewhat artificially used in the windows
  port. Now, I instead rewrote the use of gethostbyname to enlarge the host
  name buffer in case of need and totally avoid the use of the MAXHOSTNAMELEN
  define. I thus also removed the defien from the namser.h file where it was
  once added for the windows build.

  I also fixed init_by_defaults() function to not leak memory in case if
  error.
2008-06-30 12:48:25 +00:00
Yang Tse a43aec1b56 use same time source for timeout initialization and processing 2008-05-15 00:00:19 +00:00
Daniel Stenberg 46dbd9461a - Introducing millisecond resolution support for the timeout option. See
ares_init_options()'s ARES_OPT_TIMEOUTMS.
2008-05-13 20:48:48 +00:00
Yang Tse fc4704b4d8 Improved parsing of resolver configuration files 2008-05-05 17:48:25 +00:00
Daniel Stenberg cb4a169f75 Eino Tuominen improved the code when a file is used to seed the randomizer 2008-04-04 20:05:23 +00:00
Gunter Knauf b68a4326d2 removed dependency on gettimeofday() since we use only 1 sec resolution here. 2007-10-22 23:31:40 +00:00
Yang Tse 1fe4d44ed9 Fix compiler warning: conversion from "int" to "unsigned short" may lose significant bits 2007-10-20 15:11:51 +00:00
Yang Tse 0e74c9c8cf Renamed a variable to avoid shadowing a global declaration 2007-10-18 17:31:19 +00:00
Yang Tse 57abe9d22d Fix compiler warning: conversion from "int" to "unsigned char"
may lose significant bits
2007-10-18 01:01:20 +00:00
Yang Tse a15a88a4e6 Avoid a segfault when generating a DNS "Transaction ID" in internal
function init_id_key() under low memory conditions.
2007-10-02 18:26:48 +00:00
Steinar H. Gunderson 04e49e09dc Previously, processing a large batch of timeouts was O(n^2) in the number of
outstanding queries, and processing a DNS response packet was O(n) in the
number of outstanding queries. To speed things up in Google, we added a few circular,
doubly-linked lists of queries that are hash-bucketed based on
the attributes we care about, so most important operations are now O(1).

It might be that the number of buckets are higher than most people would need,
but on a quick calculation it should only be 100kB or so even on a 64-bit
system, so I've let it stay as-is.
2007-09-29 18:18:47 +00:00
Steinar H. Gunderson 56ffdcefe1 Support a few more socket options, and refactor the option setting a bit. (Patch from the Google tree.) 2007-09-28 15:15:39 +00:00
Steinar H. Gunderson b669e17544 Three fixes in one commit (sorry): a) Take care of the tcpbuf if it ends while queued for transmission, note broken servers and close them in the main loop, and store TCP socket generation number in order not to send the same query twice over the same socket. 2007-09-28 14:28:14 +00:00
Daniel Stenberg 2b43edc964 Brad House provided a fix for ares_save_options(): Apparently I overlooked
something with the ares_save_options() where it would try to do a malloc(0)
when no options of that type needed to be saved.  On most platforms, this was
fine because malloc(0) doesn't actually return NULL, but on AIX it does, so
ares_save_options would return ARES_ENOMEM.
2007-09-22 20:45:50 +00:00
Daniel Stenberg ad734e7b2d Brad House's fix to hish a win32 compiler warning 2007-07-14 13:14:58 +00:00
Daniel Stenberg 403b315a3b Vlad Dinulescu fixed two outstanding valgrind reports 2007-07-14 13:08:50 +00:00
Gunter Knauf 316c126447 few minor changes to make ares compile for NetWare CLIB architecture. 2007-07-03 16:00:36 +00:00
Daniel Stenberg fc5a460e0e Brad Spencer found and fixed three flaws in the code, found with the new
gcc 4.2.0 warning: -Waddress
2007-06-02 20:09:23 +00:00
Daniel Stenberg 49fdeb1de4 first take at detecting a random device and seeding the random key using data
from it in randomize_key()
2007-05-30 21:37:17 +00:00
Daniel Stenberg 7a77f24d26 Shmulik Regev brought cryptographically secure transaction IDs 2007-05-30 21:11:10 +00:00
Daniel Stenberg f1440b2405 Brad House added ares_save_options() and ares_destroy_options() that can be
used to keep options for later re-usal when ares_init_options() is used.
2007-05-30 20:49:14 +00:00
Daniel Stenberg 557aad7b02 Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows
that could cause it to return a bad return code.
2007-05-25 21:11:28 +00:00
Gisle Vanem a627160041 Removed inclusion of <sys/types.h> in .c-files
since it's already included through "setup.h".
2007-02-26 04:33:19 +00:00
Yang Tse 679a675660 add debug messages for initialization failures 2007-02-19 02:03:58 +00:00
Yang Tse 69fa447354 use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling 2007-02-16 15:04:44 +00:00
Yang Tse 5dceb6d883 Oops, missing argument separator comma 2007-02-14 17:38:41 +00:00
Yang Tse 8c76cf38a7 in debug messages also show error description 2007-02-14 14:11:47 +00:00
Yang Tse 6751a208d6 Fix c-ares failing to get the search sequence of /etc/hosts and
DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when
/etc/resolv.conf did not exist or was unable to read it.
2007-02-13 16:14:25 +00:00
Gisle Vanem 657c69ce9d Added HAVE_PROCESS_H for DOS/Win32.
Include <process.h> for getpid() in ares_init.c.
2007-02-06 19:09:57 +00:00
Yang Tse 6f872e206a add debug messages for initialization failures 2007-02-02 16:01:55 +00:00
Yang Tse fb38ee15e2 compiler warning fix 2007-02-01 01:42:13 +00:00
Daniel Stenberg 6a59182e81 Michael Wallner fixed this problem: When I set domains in the options
struct, and there are domain/search entries in /etc/resolv.conf, the domains
of the options struct will be overridden.
2006-11-22 22:54:41 +00:00
Yang Tse 877966659d avoid a couple of potential zero size memory allocations 2006-11-06 13:56:51 +00:00
Yang Tse dd3b42e1ac Replace is*() macros with our own IS*() ones.
Get rid of non ANSI/ISO isascii().
2006-10-18 03:42:06 +00:00