Patch generated by diffing $NODEJS/deps/cares/src to pristine c-ares 1.10 source. diff -u -r /home/fornwall/termux/c-ares/src/ares_init.c ./ares_init.c --- /home/fornwall/termux/c-ares/src/ares_init.c 2013-02-17 11:44:02.000000000 -0500 +++ ./ares_init.c 2014-09-24 17:46:41.000000000 -0400 @@ -997,6 +997,11 @@ } else if (namesrvr.sa->sa_family == AF_INET6) { + /* Windows apparently always reports some IPv6 DNS servers that + * prefixed with fec0:0:0:ffff. These ususally do not point to + * working DNS servers, so we ignore them. */ + if (strncmp(txtaddr, "fec0:0:0:ffff:", 14) == 0) + continue; if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, sizeof(namesrvr.sa6->sin6_addr)) == 0) continue; diff -u -r /home/fornwall/termux/c-ares/src/ares_nowarn.c ./ares_nowarn.c --- /home/fornwall/termux/c-ares/src/ares_nowarn.c 2013-02-13 05:01:50.000000000 -0500 +++ ./ares_nowarn.c 2014-09-24 17:46:41.000000000 -0400 @@ -36,50 +36,13 @@ #include "ares_nowarn.h" -#if (SIZEOF_SHORT == 2) -# define CARES_MASK_SSHORT 0x7FFF -# define CARES_MASK_USHORT 0xFFFF -#elif (SIZEOF_SHORT == 4) -# define CARES_MASK_SSHORT 0x7FFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFF -#elif (SIZEOF_SHORT == 8) -# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF -#else -# error "SIZEOF_SHORT not defined" -#endif +#define CARES_MASK_USHORT (~(unsigned short) 0) +#define CARES_MASK_UINT (~(unsigned int) 0) +#define CARES_MASK_ULONG (~(unsigned long) 0) -#if (SIZEOF_INT == 2) -# define CARES_MASK_SINT 0x7FFF -# define CARES_MASK_UINT 0xFFFF -#elif (SIZEOF_INT == 4) -# define CARES_MASK_SINT 0x7FFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFF -#elif (SIZEOF_INT == 8) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF -#elif (SIZEOF_INT == 16) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -#else -# error "SIZEOF_INT not defined" -#endif - -#if (CARES_SIZEOF_LONG == 2) -# define CARES_MASK_SLONG 0x7FFFL -# define CARES_MASK_ULONG 0xFFFFUL -#elif (CARES_SIZEOF_LONG == 4) -# define CARES_MASK_SLONG 0x7FFFFFFFL -# define CARES_MASK_ULONG 0xFFFFFFFFUL -#elif (CARES_SIZEOF_LONG == 8) -# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFL -# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL -#elif (CARES_SIZEOF_LONG == 16) -# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL -# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL -#else -# error "CARES_SIZEOF_LONG not defined" -#endif +#define CARES_MASK_SSHORT (CARES_MASK_USHORT >> 1) +#define CARES_MASK_SINT (CARES_MASK_UINT >> 1) +#define CARES_MASK_SLONG (CARES_MASK_ULONG >> 1) /* ** unsigned size_t to signed long diff -u -r /home/fornwall/termux/c-ares/src/ares_parse_txt_reply.c ./ares_parse_txt_reply.c --- /home/fornwall/termux/c-ares/src/ares_parse_txt_reply.c 2013-04-22 17:34:07.000000000 -0400 +++ ./ares_parse_txt_reply.c 2014-09-24 17:46:41.000000000 -0400 @@ -133,8 +133,6 @@ break; } - ++strptr; - /* Allocate storage for this TXT answer appending it to the list */ txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY); if (!txt_curr) @@ -152,6 +150,7 @@ } txt_last = txt_curr; + txt_curr->record_start = strptr == aptr; txt_curr->length = substr_len; txt_curr->txt = malloc (substr_len + 1/* Including null byte */); if (txt_curr->txt == NULL) @@ -159,6 +158,8 @@ status = ARES_ENOMEM; break; } + + ++strptr; memcpy ((char *) txt_curr->txt, strptr, substr_len); /* Make sure we NULL-terminate */ diff -u -r /home/fornwall/termux/c-ares/src/ares_setup.h ./ares_setup.h --- /home/fornwall/termux/c-ares/src/ares_setup.h 2012-04-17 16:51:22.000000000 -0400 +++ ./ares_setup.h 2014-09-24 17:46:41.000000000 -0400 @@ -75,6 +75,9 @@ /* please, do it beyond the point further indicated in this file. */ /* ================================================================ */ +#if 1 /* libuv hack */ +#include /* needed on windows */ +#else /* * c-ares external interface definitions are also used internally, * and might also include required system header files to define them. @@ -87,6 +90,7 @@ */ #include +#endif /* libuv hack */ /* ================================================================= */ /* No system header file shall be included in this file before this */