Commit 5646ae7f authored by Jason Madden's avatar Jason Madden

Bump c-ares to 1.12.

parent 9e403eeb
...@@ -20,11 +20,10 @@ Incompatible Changes ...@@ -20,11 +20,10 @@ Incompatible Changes
Libraries Libraries
--------- ---------
- Update libev to version 4.22. - Update libev to version 4.22 (was 4.20).
- Update tblib to 1.3.0. - Update tblib to 1.3.0.
- Update Cython to 0.25. - Update Cython to 0.25 (was 0.24).
- Update c-ares to version 1.11.0 (`release notes - Update c-ares to version 1.12.0 (was 1.10.0) (`release notes <https://c-ares.haxx.se/changelog.html>`_).
<https://raw.githubusercontent.com/c-ares/c-ares/cares-1_11_0/RELEASE-NOTES>`_).
- For the benefit of downstream package maintainers, gevent is now - For the benefit of downstream package maintainers, gevent is now
tested with c-ares and libev linked dynamically and not embedded tested with c-ares and libev linked dynamically and not embedded
(i.e., using the system libraries). However, only the versions (i.e., using the system libraries). However, only the versions
......
...@@ -2,9 +2,13 @@ c-ares is based on ares, and these are the people that have worked on it since ...@@ -2,9 +2,13 @@ c-ares is based on ares, and these are the people that have worked on it since
the fork was made: the fork was made:
Albert Chin Albert Chin
Alex Loukissas
Alexander Klauer
Alexander Lazic Alexander Lazic
Alexey Simak Alexey Simak
Andreas Rieke Andreas Rieke
Andrew Andkjar
Andrew Ayer
Andrew C. Morrow Andrew C. Morrow
Ashish Sharma Ashish Sharma
Ben Greear Ben Greear
...@@ -13,6 +17,7 @@ BogDan Vatra ...@@ -13,6 +17,7 @@ BogDan Vatra
Brad House Brad House
Brad Spencer Brad Spencer
Bram Matthys Bram Matthys
Chris Araman
Dan Fandrich Dan Fandrich
Daniel Johnson Daniel Johnson
Daniel Stenberg Daniel Stenberg
...@@ -23,11 +28,16 @@ Dima Tisnek ...@@ -23,11 +28,16 @@ Dima Tisnek
Dirk Manske Dirk Manske
Dominick Meglio Dominick Meglio
Doug Goldstein Doug Goldstein
Doug Kwan
Duncan Wilcox Duncan Wilcox
Eino Tuominen Eino Tuominen
Erik Kline Erik Kline
Fedor Indutny
Frederic Germain
Geert Uytterhoeven
George Neill George Neill
Gisle Vanem Gisle Vanem
Gregor Jasny
Guenter Knauf Guenter Knauf
Guilherme Balena Versiani Guilherme Balena Versiani
Gunter Knauf Gunter Knauf
...@@ -35,25 +45,38 @@ Henrik Stoerner ...@@ -35,25 +45,38 @@ Henrik Stoerner
Jakub Hrozek Jakub Hrozek
James Bursa James Bursa
Jérémy Lal Jérémy Lal
Keith Shaw
Lei Shi
Marko Kreen Marko Kreen
Michael Wallner Michael Wallner
Mike Crowe Mike Crowe
Nick Alcock Nick Alcock
Nick Mathewson Nick Mathewson
Nicolas "Pixel" Noble
Ning Dong
Oleg Pudeyev
Patrick Valsecchi
Patrik Thunstrom Patrik Thunstrom
Paul Saab
Peter Pentchev Peter Pentchev
Phil Blundell Phil Blundell
Poul Thomas Lomholt Poul Thomas Lomholt
Ravi Pratap Ravi Pratap
Robin Cornelius Robin Cornelius
Saúl Ibarra Corretgé
Sebastian at basti79.de Sebastian at basti79.de
Shmulik Regev Shmulik Regev
Stefan Bühler Stefan Bühler
Steinar H. Gunderson Steinar H. Gunderson
Svante Karlsson
Tofu Linden Tofu Linden
Tom Hughes Tom Hughes
Tor Arntsen Tor Arntsen
Viktor Szakats
Vlad Dinulescu Vlad Dinulescu
William Ahern William Ahern
Yang Tse Yang Tse
hpopescu at ixiacom.com
liren at vivisimo.com liren at vivisimo.com
nordsturm
saghul
This diff is collapsed.
...@@ -321,7 +321,7 @@ PORTS ...@@ -321,7 +321,7 @@ PORTS
Useful URLs Useful URLs
=========== ===========
c-ares http://c-ares.haxx.se/ c-ares https://c-ares.haxx.se/
MingW http://www.mingw.org/ MingW http://www.mingw.org/
MinGW-w64 http://mingw-w64.sourceforge.net/ MinGW-w64 http://mingw-w64.sourceforge.net/
......
...@@ -56,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ ...@@ -56,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \ TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \ $(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \
README.md README.md LICENSE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES) CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
...@@ -67,7 +67,7 @@ DIST_SUBDIRS = test ...@@ -67,7 +67,7 @@ DIST_SUBDIRS = test
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcares.pc pkgconfig_DATA = libcares.pc
CARES_VERSION_INFO = -version-info 3:0:1 CARES_VERSION_INFO = -version-info 4:0:2
# This flag accepts an argument of the form current[:revision[:age]]. So, # This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1. # 1.
......
# #
# c-ares Makefile for djgpp/gcc/Watt-32. # c-ares Makefile for djgpp/gcc/Watt-32.
# By Gisle Vanem <gvanem@broadpark.no> 2004. # By Gisle Vanem <gvanem@yahoo.no> 2004.
# #
......
...@@ -102,6 +102,7 @@ subdir = . ...@@ -102,6 +102,7 @@ subdir = .
SUBDIRS = SUBDIRS =
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/m4/cares-compilers.m4 \ $(top_srcdir)/m4/cares-compilers.m4 \
$(top_srcdir)/m4/cares-confopts.m4 \ $(top_srcdir)/m4/cares-confopts.m4 \
$(top_srcdir)/m4/cares-functions.m4 \ $(top_srcdir)/m4/cares-functions.m4 \
...@@ -388,6 +389,10 @@ CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ ...@@ -388,6 +389,10 @@ CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
CPP = @CPP@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CPPFLAG_CARES_STATICLIB = @CPPFLAG_CARES_STATICLIB@ CPPFLAG_CARES_STATICLIB = @CPPFLAG_CARES_STATICLIB@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
...@@ -403,6 +408,7 @@ FGREP = @FGREP@ ...@@ -403,6 +408,7 @@ FGREP = @FGREP@
GCOV = @GCOV@ GCOV = @GCOV@
GENHTML = @GENHTML@ GENHTML = @GENHTML@
GREP = @GREP@ GREP = @GREP@
HAVE_CXX11 = @HAVE_CXX11@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
...@@ -449,6 +455,7 @@ abs_top_builddir = @abs_top_builddir@ ...@@ -449,6 +455,7 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@ abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@ ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@ ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@ am__include = @am__include@
am__leading_dot = @am__leading_dot@ am__leading_dot = @am__leading_dot@
...@@ -541,14 +548,14 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ ...@@ -541,14 +548,14 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \ TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \ $(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \
README.md README.md LICENSE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES) CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
DISTCLEANFILES = ares_build.h DISTCLEANFILES = ares_build.h
DIST_SUBDIRS = test DIST_SUBDIRS = test
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcares.pc pkgconfig_DATA = libcares.pc
CARES_VERSION_INFO = -version-info 3:0:1 CARES_VERSION_INFO = -version-info 4:0:2
# This flag accepts an argument of the form current[:revision[:age]]. So, # This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1. # 1.
......
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
LIB = libcares.a LIB = libcares.a
AR = ar AR = $(CROSSPREFIX)ar
CC = gcc CC = $(CROSSPREFIX)gcc
LD = gcc LD = $(CROSSPREFIX)gcc
RANLIB = ranlib RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f #RM = rm -f
CP = cp -afv CP = cp -afv
CFLAGS = -O2 -Wall -I. CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I.
CFLAGS += -DCARES_STATICLIB CFLAGS += -DCARES_STATICLIB
LDFLAGS = -s LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lwsock32 LIBS = -lwsock32
# Makefile.inc provides the CSOURCES and HHEADERS defines # Makefile.inc provides the CSOURCES and HHEADERS defines
...@@ -74,4 +74,3 @@ distclean: clean ...@@ -74,4 +74,3 @@ distclean: clean
ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist" ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist"
$(RM) ares_build.h $(RM) ares_build.h
endif endif
...@@ -71,74 +71,10 @@ RTLIBD = /MTd ...@@ -71,74 +71,10 @@ RTLIBD = /MTd
USE_WATT32 = 0 USE_WATT32 = 0
# ------------------------------------------- # --------------------------------------------------------
# Detect NMAKE version deducing MSVC version # Detect compiler version.
# ------------------------------------------- # --------------------------------------------------------
!INCLUDE .\msvc_ver.inc
!IFNDEF _NMAKE_VER
! MESSAGE Macro _NMAKE_VER not defined.
! MESSAGE Use MSVC's NMAKE to process this makefile.
! ERROR See previous message.
!ENDIF
!IF "$(_NMAKE_VER)" == "6.00.8168.0"
CC_VERS_NUM = 60
!ELSEIF "$(_NMAKE_VER)" == "6.00.9782.0"
CC_VERS_NUM = 60
!ELSEIF "$(_NMAKE_VER)" == "7.00.8882"
CC_VERS_NUM = 70
!ELSEIF "$(_NMAKE_VER)" == "7.00.9466"
CC_VERS_NUM = 70
!ELSEIF "$(_NMAKE_VER)" == "7.00.9955"
CC_VERS_NUM = 70
!ELSEIF "$(_NMAKE_VER)" == "7.10.2240.8"
CC_VERS_NUM = 71
!ELSEIF "$(_NMAKE_VER)" == "7.10.3077"
CC_VERS_NUM = 71
!ELSEIF "$(_NMAKE_VER)" == "8.00.40607.16"
CC_VERS_NUM = 80
!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.42"
CC_VERS_NUM = 80
!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.762"
CC_VERS_NUM = 80
!ELSEIF "$(_NMAKE_VER)" == "9.00.20706.01"
CC_VERS_NUM = 90
!ELSEIF "$(_NMAKE_VER)" == "9.00.21022.08"
CC_VERS_NUM = 90
!ELSEIF "$(_NMAKE_VER)" == "9.00.30729.01"
CC_VERS_NUM = 90
!ELSEIF "$(_NMAKE_VER)" == "10.00.20506.01"
CC_VERS_NUM = 100
!ELSEIF "$(_NMAKE_VER)" == "10.00.21003.01"
CC_VERS_NUM = 100
!ELSEIF "$(_NMAKE_VER)" == "10.00.30128.01"
CC_VERS_NUM = 100
!ELSEIF "$(_NMAKE_VER)" == "10.00.30319.01"
CC_VERS_NUM = 100
!ELSEIF "$(_NMAKE_VER)" == "10.00.40219.01"
CC_VERS_NUM = 100
!ELSEIF "$(_NMAKE_VER)" == "11.00.50522.1"
CC_VERS_NUM = 110
!ELSEIF "$(_NMAKE_VER)" == "11.00.50727.1"
CC_VERS_NUM = 110
!ELSEIF "$(_NMAKE_VER)" == "11.00.51106.1"
CC_VERS_NUM = 110
!ELSEIF "$(_NMAKE_VER)" == "11.00.60315.1"
CC_VERS_NUM = 110
!ELSEIF "$(_NMAKE_VER)" == "11.00.61030.0"
CC_VERS_NUM = 110
!ELSEIF "$(_NMAKE_VER)" == "12.00.21005.1"
CC_VERS_NUM = 120
!ELSEIF "$(_NMAKE_VER)" == "14.00.23026.0"
CC_VERS_NUM = 140
!ELSE
! MESSAGE Unknown value for _NMAKE_VER macro: "$(_NMAKE_VER)"
! MESSAGE Please, report this condition on the c-ares development
! MESSAGE mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
! ERROR See previous message.
!ENDIF
CC_VERS_STR = msvc$(CC_VERS_NUM)
# ---------------------------------------------------- # ----------------------------------------------------
# Verify that current subdir is the c-ares source one # Verify that current subdir is the c-ares source one
......
...@@ -306,7 +306,6 @@ ifeq ($(LIBARCH),CLIB) ...@@ -306,7 +306,6 @@ ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@
else else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
...@@ -349,8 +348,6 @@ else ...@@ -349,8 +348,6 @@ else
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
endif endif
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
...@@ -397,9 +394,6 @@ endif ...@@ -397,9 +394,6 @@ endif
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@ @echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SIZEOF_INT 4$(DL) >> $@
@echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
ifdef NW_WINSOCK ifdef NW_WINSOCK
...@@ -431,11 +425,8 @@ ares_build.h: Makefile.netware FORCE ...@@ -431,11 +425,8 @@ ares_build.h: Makefile.netware FORCE
@echo $(DL)#define __CARES_BUILD_H$(DL) >> $@ @echo $(DL)#define __CARES_BUILD_H$(DL) >> $@
ifeq ($(LIBARCH),CLIB) ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@ @echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@
@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@
else else
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@ @echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@
@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@
endif endif
@echo $(DL)#define CARES_SIZEOF_LONG 4$(DL) >> $@
@echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@ @echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@
@echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@ @echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@
...@@ -12,4 +12,4 @@ compatible with ares: a new name makes that more obvious to the public. ...@@ -12,4 +12,4 @@ compatible with ares: a new name makes that more obvious to the public.
The original libares was distributed at The original libares was distributed at
ftp://athena-dist.mit.edu:pub/ATHENA/ares (which seems to not be alive ftp://athena-dist.mit.edu:pub/ATHENA/ares (which seems to not be alive
anymore). A local copy of the original ares package is kept here: anymore). A local copy of the original ares package is kept here:
http://c-ares.haxx.se/download/ares-1.1.1.tar.gz https://c-ares.haxx.se/download/ares-1.1.1.tar.gz
...@@ -4,6 +4,7 @@ c-ares ...@@ -4,6 +4,7 @@ c-ares
[![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares) [![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares)
[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master) [![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291)
This is c-ares, an asynchronous resolver library. It is intended for This is c-ares, an asynchronous resolver library. It is intended for
applications which need to perform DNS queries without blocking, or need to applications which need to perform DNS queries without blocking, or need to
...@@ -22,7 +23,7 @@ c-ares is of course distributed under the same MIT-style license as the ...@@ -22,7 +23,7 @@ c-ares is of course distributed under the same MIT-style license as the
original ares. original ares.
You'll find all c-ares details and news here: You'll find all c-ares details and news here:
http://c-ares.haxx.se/ https://c-ares.haxx.se/
Notes for c-ares hackers Notes for c-ares hackers
......
c-ares version 1.11.0 c-ares version 1.12.0
Changes: Changes:
o Add a unit test suite o api: add ARES_OPT_NOROTATE optmask value
o Allow builds with code converage with --enable-code-coverage configure option
o Allow library-wide override of malloc/free
o Allow multiple -s options to the ahost command
o api: Expose the ares_library_initialized() function
o api: Add ares_set_sortlist(3) entrypoint
o api: Add entrypoints to allow use of per-server ports
o api: introduce `ares_parse_txt_reply_ext`
o api: Add ares_set_socket_configure_callback()
Bug fixes: Bug fixes:
o timeadd: make static o CVE-2016-5180: ares_create_query single byte out of buffer write [4]
o timeoffset: made static and private o configure: acknowledge --disable-tests [1]
o nowarn: use <limits.h> instead of configure for size of long o man pages: fix typos detected by Lintian
o single_domain: Invalid memory access for empty string input o test: add missing #includes for dns-proto.cc
o ares_build.h: fix building on 64-bit powerpc o test: avoid in6addr_* constants
o Allow specification of search domain in ahost o test: Build with MinGW on AppVeyor
o Don't override explicitly specified search domains o Makefile.m32: add support for extra flags
o ares_parse_soa_reply: Do not leak rr_name on allocation failure o Makefile.m32: add support for CROSSPREFIX
o Update ahost man page to describe -s option o configure: check if tests can get built before enabled
o host_callback: Fall back to AF_INET on searching with AF_UNSPEC o ares_library_cleanup: reset ares_realloc too
o Add -t u option to ahost o ahost.c: add cast to fix C++ compile
o CONTRIBUTING: added o test: Only pass unused args to GoogleTest
o ares_set_servers_csv: fix NULL dereference o build: commonize MSVC version detection
o Fix integer shift overflow if both tcp_socket and udp_socket are set o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3
o fix acountry memory leak o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record
o lookup_service: prevent tmpbuf from overrunning o ares_getnameinfo: explicitly clear struct servent before use
o ares_getnameinfo.3: there is no ares_getaddrinfo o test: Update fuzzing function prototype
o init_by_defaults: Continue loop if space for hostname not large enough o init: fix nsort initialization
o Destroy options if ares_save_options fails o test: add fuzzing check script to tests
o ares__read_line: free buf on realloc failure o web: http => https
o added define for visual studio 2013 o read_tcp_data: remove superfluous NULL check
o windows: fix slow DNS lookup issue o LICENSE.md: add a stand-alone license file
o Use libresolv to initialize cares on iPhone targets o SECURITY.md: suggested "security process" for the project
o buildconf: remove check for libtool, it only requires libtoolize o ares_init_options: only propagate init failures from options [2]
o init_by_resolv_conf: Don't exit loop early leaving uninitialized entries o headers: remove checks for and defines of variable sizes
o ahost: check the select() return code o test: fix gMock to work with gcc >= 6.x [3]
o configure_socket: explicitly ignore return code
o read_tcp_data: don't try to use NULL pointer after malloc failure
o Distribute all man pages
o ares_expand_name: check for valid bits in label length
o ares__read_line: clear buf pointer on realloc failure
o process_answer: fix things up correctly when removing EDNS option
o ares_parse_txt_reply: propagate errors from per-substring loop
o ares_gethostbyname: don't leak valid-but-empty hostent
o ares_init_options: don't lose init failure
o ares_dup: clear new channel on failure
o config_sortlist: free any existing sortlist on (re)alloc failure
o ares_striendstr: fix so non-NULL return can happen
o bitncmp: update comment to match code behaviour
o ares_set_servers_csv.3: make return type match code
o init_by_resolv_conf: ignore `fopen` errors to use default values
o Use "resolve" as synonym of "dns" in nsswitch.conf
o ares_win32_init: make LoadLibrary work when using UNICODE too
o dist: Distribute README.md
o configure: build silently by default
o ares_dup.3: remove mention of nonexistent function
Thanks go to these friendly people for their efforts and contributions: Thanks go to these friendly people for their efforts and contributions:
Andrew Andkjar, Andrew Ayer, Daniel Stenberg, David Drysdale, Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg,
Doug Kwan, Fedor Indutny, Frederic Germain, Gisle Vanem, Gregor Jasny, David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats
Guenter Knauf, Jakub Hrozek, Lei Shi, Nicolas "Pixel" Noble,
Svante Karlsson, Tor Arntsen, Yang Tse
Have fun! References to bug reports and discussions on issues:
[1] = https://github.com/c-ares/c-ares/issues/44
[2] = https://github.com/c-ares/c-ares/issues/60
[3] = https://github.com/google/googletest/issues/705#issuecomment-235067917
[4] = https://c-ares.haxx.se/adv_20160929.html
...@@ -1187,6 +1187,7 @@ AC_SUBST([am__untar]) ...@@ -1187,6 +1187,7 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR ]) # _AM_PROG_TAR
m4_include([m4/ax_code_coverage.m4]) m4_include([m4/ax_code_coverage.m4])
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
m4_include([m4/cares-compilers.m4]) m4_include([m4/cares-compilers.m4])
m4_include([m4/cares-confopts.m4]) m4_include([m4/cares-confopts.m4])
m4_include([m4/cares-functions.m4]) m4_include([m4/cares-functions.m4])
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* Ref: http://countries.nerd.dk/more.html * Ref: http://countries.nerd.dk/more.html
* *
* Written by G. Vanem <gvanem@broadpark.no> 2006, 2007 * Written by G. Vanem <gvanem@yahoo.no> 2006, 2007
* *
* NB! This program may not be big-endian aware. * NB! This program may not be big-endian aware.
* *
......
...@@ -88,7 +88,7 @@ int main(int argc, char **argv) ...@@ -88,7 +88,7 @@ int main(int argc, char **argv)
case 's': case 's':
optmask |= ARES_OPT_DOMAINS; optmask |= ARES_OPT_DOMAINS;
options.ndomains++; options.ndomains++;
options.domains = realloc(options.domains, options.domains = (char **)realloc(options.domains,
options.ndomains * sizeof(char *)); options.ndomains * sizeof(char *));
options.domains[options.ndomains - 1] = strdup(optarg); options.domains[options.ndomains - 1] = strdup(optarg);
break; break;
......
...@@ -158,6 +158,7 @@ extern "C" { ...@@ -158,6 +158,7 @@ extern "C" {
#define ARES_OPT_TIMEOUTMS (1 << 13) #define ARES_OPT_TIMEOUTMS (1 << 13)
#define ARES_OPT_ROTATE (1 << 14) #define ARES_OPT_ROTATE (1 << 14)
#define ARES_OPT_EDNSPSZ (1 << 15) #define ARES_OPT_EDNSPSZ (1 << 15)
#define ARES_OPT_NOROTATE (1 << 16)
/* Nameinfo flag values */ /* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0) #define ARES_NI_NOFQDN (1 << 0)
......
...@@ -83,148 +83,88 @@ ...@@ -83,148 +83,88 @@
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */ /* ================================================================ */
#ifdef CARES_SIZEOF_LONG
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
#endif
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif #endif
#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
#endif
/* ================================================================ */ /* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
/* ================================================================ */ /* ================================================================ */
#if defined(__DJGPP__) || defined(__GO32__) #if defined(__DJGPP__) || defined(__GO32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__SALFORDC__) #elif defined(__SALFORDC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__TURBOC__) #elif defined(__TURBOC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__POCC__) #elif defined(__POCC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__LCC__) #elif defined(__LCC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__SYMBIAN32__) #elif defined(__SYMBIAN32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__MWERKS__) #elif defined(__MWERKS__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(_WIN32_WCE) #elif defined(_WIN32_WCE)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__VMS) #elif defined(__VMS)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__OS400__) #elif defined(__OS400__)
# if defined(__ILEC400__) # if defined(__ILEC400__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(__MVS__) #elif defined(__MVS__)
# if defined(__IBMC__) || defined(__IBMCPP__) # if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CARES_SIZEOF_LONG 4
# elif defined(_LP64)
# define CARES_SIZEOF_LONG 8
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(__370__) #elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__) # if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CARES_SIZEOF_LONG 4
# elif defined(_LP64)
# define CARES_SIZEOF_LONG 8
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(TPF) #elif defined(TPF)
# define CARES_SIZEOF_LONG 8
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
/* ===================================== */ /* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */ /* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */ /* ===================================== */
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
/* ===================================== */ /* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */ /* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */ /* ===================================== */
#elif defined(__GNUC__) #elif defined(__GNUC__)
# if defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__)
# define CARES_SIZEOF_LONG 8
# elif defined(__ILP32__) || \
defined(__i386__) || defined(__ppc__) || defined(__arm__)
# define CARES_SIZEOF_LONG 4
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
......
...@@ -50,21 +50,11 @@ ...@@ -50,21 +50,11 @@
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */ /* ================================================================ */
#ifdef CARES_SIZEOF_LONG
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
#endif
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif #endif
#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
#endif
/* ================================================================ */ /* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ /* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
/* ================================================================ */ /* ================================================================ */
...@@ -95,15 +85,9 @@ ...@@ -95,15 +85,9 @@
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
/* The size of `long', as computed by sizeof. */
#undef CARES_SIZEOF_LONG
/* Integral data type used for ares_socklen_t. */ /* Integral data type used for ares_socklen_t. */
#undef CARES_TYPEOF_ARES_SOCKLEN_T #undef CARES_TYPEOF_ARES_SOCKLEN_T
/* The size of `ares_socklen_t', as computed by sizeof. */
#undef CARES_SIZEOF_ARES_SOCKLEN_T
/* Data type definition of ares_socklen_t. */ /* Data type definition of ares_socklen_t. */
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
......
...@@ -23,14 +23,15 @@ ares_cancel \- Cancel a resolve ...@@ -23,14 +23,15 @@ ares_cancel \- Cancel a resolve
.B void ares_cancel(ares_channel \fIchannel\fP) .B void ares_cancel(ares_channel \fIchannel\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The \fBares_cancel\fP function cancels all lookups/requests made on the the The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the
name service channel identified by \fIchannel\fP. \fBares_cancel\fP invokes name service channel identified by \fIchannel\fP. \fBares_cancel(3)\fP
the callbacks for each pending query on the channel, passing a status of invokes the callbacks for each pending query on the channel, passing a status
of
.BR ARES_ECANCELLED . .BR ARES_ECANCELLED .
These calls give the callbacks a chance to clean up any state which These calls give the callbacks a chance to clean up any state which might have
might have been stored in their arguments. If such a callback invocation adds been stored in their arguments. If such a callback invocation adds a new
a new request to the channel, that request will \fInot\fP be cancelled by the request to the channel, that request will \fInot\fP be cancelled by the
current invocation of \fBares_cancel\fP. current invocation of \fBares_cancel(3)\fP.
.SH SEE ALSO .SH SEE ALSO
.BR ares_init (3) .BR ares_init (3)
.BR ares_destroy (3) .BR ares_destroy (3)
......
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
/* Define to 1 if you have the connect function. */ /* Define to 1 if you have the connect function. */
#undef HAVE_CONNECT #undef HAVE_CONNECT
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
...@@ -442,27 +445,6 @@ ...@@ -442,27 +445,6 @@
/* Define to the function return type for send. */ /* Define to the function return type for send. */
#undef SEND_TYPE_RETV #undef SEND_TYPE_RETV
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* The size of `struct in6_addr', as computed by sizeof. */
#undef SIZEOF_STRUCT_IN6_ADDR
/* The size of `struct in_addr', as computed by sizeof. */
#undef SIZEOF_STRUCT_IN_ADDR
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
......
...@@ -18,45 +18,39 @@ ...@@ -18,45 +18,39 @@
ares_create_query \- Compose a single-question DNS query buffer ares_create_query \- Compose a single-question DNS query buffer
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B int ares_create_query(const char *\fIname\fP, int \fIdnsclass\fP,\ int ares_create_query(const char *\fIname\fP,
int \fIdnsclass\fP,
int \fItype\fP, int \fItype\fP,
.B unsigned short \fIid\fP, int \fIrd\fP,\ unsigned short \fIid\fP,
int \fIrd\fP,
unsigned char **\fIbuf\fP, unsigned char **\fIbuf\fP,
.B int *\fIbuflen\fP, int \fImax_udp_size\fP) int *\fIbuflen\fP,
int \fImax_udp_size\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fIares_create_query(3)\fP function composes a DNS query with a single
.B ares_create_query question. The parameter \fIname\fP gives the query name as a NUL-terminated C
function composes a DNS query with a single question. string of period-separated labels optionally ending with a period; periods and
The parameter backslashes within a label must be escaped with a backlash.
.I name
gives the query name as a NUL-terminated C string of period-separated The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the
labels optionally ending with a period; periods and backslashes within query using the values defined in \fB<arpa/nameser.h>\fP.
a label must be escaped with a backlash. The parameters
.I dnsclass The parameter \fIid\fP gives a 16-bit identifier for the query.
and
.I type The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not.
give the class and type of the query using the values defined in
.BR <arpa/nameser.h> . The query will be placed in an allocated buffer, a pointer to which will be
The parameter stored in the variable pointed to by \fIbuf\fP, and the length of which will
.I id be stored in the variable pointed to by \fIbuflen\fP.
gives a 16-bit identifier for the query. The parameter
.I rd
should be nonzero if recursion is desired, zero if not. The query
will be placed in an allocated buffer, a pointer to which will be
stored in the variable pointed to by
.IR buf ,
and the length of which will be stored in the variable pointed to by
.IR buflen .
It is the caller's responsibility to free this buffer using It is the caller's responsibility to free this buffer using
\fIares_free_string(3)\fP when it is no longer needed. \fIares_free_string(3)\fP when it is no longer needed. The parameter
The parameter \fImax_udp_size\fP should be nonzero to activate EDNS. Usage of
.I max_udp_size \fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent
should be nonzero to activate EDNS. Usage of \fIares_create_query(3)\fP\ with to using \fIares_mkquery(3)\fP.
.I max_udp_size
set to zero is equivalent to \fIares_mkquery(3)\fP.
.SH RETURN VALUES .SH RETURN VALUES
.B ares_create_query .B ares_create_query
can return any of the following values: can return any of the following values:
...@@ -77,5 +71,6 @@ Memory was exhausted. ...@@ -77,5 +71,6 @@ Memory was exhausted.
Added in c-ares 1.10.0 Added in c-ares 1.10.0
.SH SEE ALSO .SH SEE ALSO
.BR ares_expand_name (3), .BR ares_expand_name (3),
.BR ares_free_string (3) .BR ares_free_string (3),
.BR ares_mkquery (3)
.SH AUTHOR .SH AUTHOR
...@@ -85,57 +85,31 @@ ...@@ -85,57 +85,31 @@
*/ */
int ares_create_query(const char *name, int dnsclass, int type, int ares_create_query(const char *name, int dnsclass, int type,
unsigned short id, int rd, unsigned char **buf, unsigned short id, int rd, unsigned char **bufp,
int *buflen, int max_udp_size) int *buflenp, int max_udp_size)
{ {
int len; size_t len;
unsigned char *q; unsigned char *q;
const char *p; const char *p;
size_t buflen;
unsigned char *buf;
/* Set our results early, in case we bail out early with an error. */ /* Set our results early, in case we bail out early with an error. */
*buflen = 0; *buflenp = 0;
*buf = NULL; *bufp = NULL;
/* Compute the length of the encoded name so we can check buflen. /* Allocate a memory area for the maximum size this packet might need. +2
* Start counting at 1 for the zero-length label at the end. */ * is for the length byte and zero termination if no dots or ecscaping is
len = 1; * used.
for (p = name; *p; p++)
{
if (*p == '\\' && *(p + 1) != 0)
p++;
len++;
}
/* If there are n periods in the name, there are n + 1 labels, and
* thus n + 1 length fields, unless the name is empty or ends with a
* period. So add 1 unless name is empty or ends with a period.
*/ */
if (*name && *(p - 1) != '.') len = strlen(name) + 2 + HFIXEDSZ + QFIXEDSZ +
len++; (max_udp_size ? EDNSFIXEDSZ : 0);
buf = ares_malloc(len);
/* Immediately reject names that are longer than the maximum of 255 if (!buf)
* bytes that's specified in RFC 1035 ("To simplify implementations,
* the total length of a domain name (i.e., label octets and label
* length octets) is restricted to 255 octets or less."). We aren't
* doing this just to be a stickler about RFCs. For names that are
* too long, 'dnscache' closes its TCP connection to us immediately
* (when using TCP) and ignores the request when using UDP, and
* BIND's named returns ServFail (TCP or UDP). Sending a request
* that we know will cause 'dnscache' to close the TCP connection is
* painful, since that makes any other outstanding requests on that
* connection fail. And sending a UDP request that we know
* 'dnscache' will ignore is bad because resources will be tied up
* until we time-out the request.
*/
if (len > MAXCDNAME)
return ARES_EBADNAME;
*buflen = len + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0);
*buf = ares_malloc(*buflen);
if (!*buf)
return ARES_ENOMEM; return ARES_ENOMEM;
/* Set up the header. */ /* Set up the header. */
q = *buf; q = buf;
memset(q, 0, HFIXEDSZ); memset(q, 0, HFIXEDSZ);
DNS_HEADER_SET_QID(q, id); DNS_HEADER_SET_QID(q, id);
DNS_HEADER_SET_OPCODE(q, QUERY); DNS_HEADER_SET_OPCODE(q, QUERY);
...@@ -159,8 +133,10 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -159,8 +133,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
q += HFIXEDSZ; q += HFIXEDSZ;
while (*name) while (*name)
{ {
if (*name == '.') if (*name == '.') {
free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
}
/* Count the number of bytes in this label. */ /* Count the number of bytes in this label. */
len = 0; len = 0;
...@@ -170,8 +146,10 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -170,8 +146,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
p++; p++;
len++; len++;
} }
if (len > MAXLABEL) if (len > MAXLABEL) {
free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
}
/* Encode the length and copy the data. */ /* Encode the length and copy the data. */
*q++ = (unsigned char)len; *q++ = (unsigned char)len;
...@@ -195,14 +173,30 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -195,14 +173,30 @@ int ares_create_query(const char *name, int dnsclass, int type,
DNS_QUESTION_SET_TYPE(q, type); DNS_QUESTION_SET_TYPE(q, type);
DNS_QUESTION_SET_CLASS(q, dnsclass); DNS_QUESTION_SET_CLASS(q, dnsclass);
q += QFIXEDSZ;
if (max_udp_size) if (max_udp_size)
{ {
q += QFIXEDSZ;
memset(q, 0, EDNSFIXEDSZ); memset(q, 0, EDNSFIXEDSZ);
q++; q++;
DNS_RR_SET_TYPE(q, T_OPT); DNS_RR_SET_TYPE(q, T_OPT);
DNS_RR_SET_CLASS(q, max_udp_size); DNS_RR_SET_CLASS(q, max_udp_size);
q += (EDNSFIXEDSZ-1);
}
buflen = (q - buf);
/* Reject names that are longer than the maximum of 255 bytes that's
* specified in RFC 1035 ("To simplify implementations, the total length of
* a domain name (i.e., label octets and label length octets) is restricted
* to 255 octets or less."). */
if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
(max_udp_size ? EDNSFIXEDSZ : 0))) {
free (buf);
return ARES_EBADNAME;
} }
/* we know this fits in an int at this point */
*buflenp = (int) buflen;
*bufp = buf;
return ARES_SUCCESS; return ARES_SUCCESS;
} }
...@@ -23,18 +23,14 @@ ares_destroy \- Destroy a resolver channel ...@@ -23,18 +23,14 @@ ares_destroy \- Destroy a resolver channel
.B void ares_destroy(ares_channel \fIchannel\fP) .B void ares_destroy(ares_channel \fIchannel\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_destroy(3)\fP function destroys the name service channel
.B ares_destroy identified by \fIchannel\fP, freeing all memory and closing all sockets used
function destroys the name service channel identified by by the channel.
.IR channel ,
freeing all memory and closing all sockets used by the channel. \fBares_destroy(3)\fP invokes the callbacks for each pending query on the
.B ares_destroy channel, passing a status of \IARES_EDESTRUCTION\fP. These calls give the
invokes the callbacks for each pending query on the channel, passing a callbacks a chance to clean up any state which might have been stored in their
status of arguments. A callback must not add new requests to a channel being destroyed.
.BR ARES_EDESTRUCTION .
These calls give the callbacks a chance to clean up any state which
might have been stored in their arguments. A callback must not add new
requests to a channel being destroyed.
.SH SEE ALSO .SH SEE ALSO
.BR ares_init (3), .BR ares_init (3),
.BR ares_cancel (3) .BR ares_cancel (3)
......
...@@ -23,12 +23,9 @@ ares_destroy_options \- Destroy options initialized with ares_save_options ...@@ -23,12 +23,9 @@ ares_destroy_options \- Destroy options initialized with ares_save_options
.B void ares_destroy_options(struct ares_options *\fIoptions\fP) .B void ares_destroy_options(struct ares_options *\fIoptions\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_destroy_options(3)\fP function destroys the options struct
.B ares_destroy_options identified by \Ioptions\fP, freeing all memory allocated by
function destroys the options struct identified by \fBares_save_options(3)\fP.
.IR options ,
freeing all memory allocated by ares_save_options.
.SH SEE ALSO .SH SEE ALSO
.BR ares_save_options (3), .BR ares_save_options (3),
.BR ares_init_options (3) .BR ares_init_options (3)
......
...@@ -33,7 +33,7 @@ handle when the channel is no longer needed. ...@@ -33,7 +33,7 @@ handle when the channel is no longer needed.
.BR ares_init(3), .BR ares_init(3),
.BR ares_library_init(3) .BR ares_library_init(3)
.SH AVAILABILITY .SH AVAILABILITY
ares_dup(3) was added in c-ares 1.6.0 \fIares_dup(3)\fP was added in c-ares 1.6.0
.SH AUTHOR .SH AUTHOR
Daniel Stenberg Daniel Stenberg
...@@ -23,9 +23,8 @@ ares_free_string \- Free strings allocated by ares functions ...@@ -23,9 +23,8 @@ ares_free_string \- Free strings allocated by ares functions
.B void ares_free_string(void *\fIstr\fP) .B void ares_free_string(void *\fIstr\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fIares_free_string(3)\fP function frees a string allocated by an ares
.I ares_free_string function.
function frees a string allocated by an ares function.
.SH SEE ALSO .SH SEE ALSO
.BR ares_mkquery (3) .BR ares_mkquery (3)
.BR ares_expand_string (3) .BR ares_expand_string (3)
......
...@@ -56,7 +56,7 @@ IPv4-only name server usage. ...@@ -56,7 +56,7 @@ IPv4-only name server usage.
This function may return any of the following values: This function may return any of the following values:
.TP 15 .TP 15
.B ARES_SUCCESS .B ARES_SUCCESS
The name servers configuration was successfuly retrieved The name servers configuration was successfully retrieved
.TP 15 .TP 15
.B ARES_ENOMEM .B ARES_ENOMEM
The memory was exhausted The memory was exhausted
......
...@@ -299,6 +299,7 @@ static char *lookup_service(unsigned short port, int flags, ...@@ -299,6 +299,7 @@ static char *lookup_service(unsigned short port, int flags,
else else
proto = "tcp"; proto = "tcp";
#ifdef HAVE_GETSERVBYPORT_R #ifdef HAVE_GETSERVBYPORT_R
memset(&se, 0, sizeof(se));
sep = &se; sep = &se;
memset(tmpbuf, 0, sizeof(tmpbuf)); memset(tmpbuf, 0, sizeof(tmpbuf));
#if GETSERVBYPORT_R_ARGS == 6 #if GETSERVBYPORT_R_ARGS == 6
......
...@@ -16,167 +16,24 @@ ...@@ -16,167 +16,24 @@
.\" .\"
.TH ARES_INIT 3 "5 March 2010" .TH ARES_INIT 3 "5 March 2010"
.SH NAME .SH NAME
ares_init, ares_init_options \- Initialize a resolver channel ares_init \- Initialize a resolver channel
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B int ares_init(ares_channel *\fIchannelptr\fP) int ares_init(ares_channel *\fIchannelptr\fP)
.B int ares_init_options(ares_channel *\fIchannelptr\fP,
.B struct ares_options *\fIoptions\fP, int \fIoptmask\fP)
.PP
.B cc file.c -lcares
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The \fBares_init\fP function initializes a communications channel for name The \fBares_init(3)\fP function initializes a communications channel for name
service lookups. If it returns successfully, \fBares_init\fP will set the service lookups. If it returns successfully, \fBares_init(3)\fP will set the
variable pointed to by \fIchannelptr\fP to a handle used to identify the name variable pointed to by \fIchannelptr\fP to a handle used to identify the name
service channel. The caller should invoke service channel. The caller should invoke \fIares_destroy(3)\fP on the handle
.BR ares_destroy (3) when the channel is no longer needed.
on the handle when the channel is no longer needed.
.PP The \fIares_init_options(3)\fP function is provide to offer more init
The \fBares_init_options\fP function also initializes a name service channel, alternatives.
with additional options useful for applications requiring more control over
name service configuration. The \fIoptmask\fP parameter specifies which fields
in the structure pointed to by \fIoptions\fP are set, as follows:
.TP 18
.B ARES_OPT_FLAGS
.B int \fIflags\fP;
.br
Flags controlling the behavior of the resolver. See below for a
description of possible flag values.
.TP 18
.B ARES_OPT_TIMEOUT
.B int \fItimeout\fP;
.br
The number of seconds each name server is given to respond to a query on the
first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. This option is being deprecated by
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
.TP 18
.B ARES_OPT_TIMEOUTMS
.B int \fItimeout\fP;
.br
The number of milliseconds each name server is given to respond to a query on
the first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. Note that this option is specified with the same
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
that tell c-ares how to interpret the number. This option was added in c-ares
1.5.2.
.TP 18
.B ARES_OPT_TRIES
.B int \fItries\fP;
.br
The number of tries the resolver will try contacting each name server
before giving up. The default is four tries.
.TP 18
.B ARES_OPT_NDOTS
.B int \fIndots\fP;
.br
The number of dots which must be present in a domain name for it to be
queried for "as is" prior to querying for it with the default domain
extensions appended. The default value is 1 unless set otherwise by
resolv.conf or the RES_OPTIONS environment variable.
.TP 18
.B ARES_OPT_PORT
.B unsigned short \fIport\fP;
.br
The port to use for queries (both TCP and UDP), in network byte order.
The default value is 53 (in network byte order), the standard name
service port.
.TP 18
.B ARES_OPT_SERVERS
.B struct in_addr *\fIservers\fP;
.br
.B int \fInservers\fP;
.br
The list of IPv4 servers to contact, instead of the servers specified in
resolv.conf or the local named. In order to allow specification of either
IPv4 or IPv6 name servers, the
.BR ares_set_servers(3)
function must be used instead.
.TP 18
.B ARES_OPT_DOMAINS
.B char **\fIdomains\fP;
.br
.B int \fIndomains\fP;
.br
The domains to search, instead of the domains specified in resolv.conf
or the domain derived from the kernel hostname variable.
.TP 18
.B ARES_OPT_LOOKUPS
.B char *\fIlookups\fP;
.br
The lookups to perform for host queries.
.I lookups
should be set to a string of the characters "b" or "f", where "b"
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
.TP 18
.B ARES_OPT_SOCK_STATE_CB
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
.br
.B void *\fIsock_state_cb_data\fP;
.br
A callback function to be invoked when a socket changes state.
.I s
will be passed the socket whose state has changed;
.I read
will be set to true if the socket should listen for read events, and
.I write
will be set to true if the socket should listen for write events.
The value of
.I sock_state_cb_data
will be passed as the
.I data
argument.
.PP
The
.I flags
field should be the bitwise or of some subset of the following values:
.TP 23
.B ARES_FLAG_USEVC
Always use TCP queries (the "virtual circuit") instead of UDP
queries. Normally, TCP is only used if a UDP query yields a truncated
result.
.TP 23
.B ARES_FLAG_PRIMARY
Only query the first server in the list of servers to query.
.TP 23
.B ARES_FLAG_IGNTC
If a truncated response to a UDP query is received, do not fall back
to TCP; simply continue on with the truncated response.
.TP 23
.B ARES_FLAG_NORECURSE
Do not set the "recursion desired" bit on outgoing queries, so that the name
server being contacted will not try to fetch the answer from other servers if
it doesn't know the answer locally. Be aware that ares will not do the
recursion for you. Recursion must be handled by the application calling ares
if \fIARES_FLAG_NORECURSE\fP is set.
.TP 23
.B ARES_FLAG_STAYOPEN
Do not close communications sockets when the number of active queries
drops to zero.
.TP 23
.B ARES_FLAG_NOSEARCH
Do not use the default search domains; only query hostnames as-is or
as aliases.
.TP 23
.B ARES_FLAG_NOALIASES
Do not honor the HOSTALIASES environment variable, which normally
specifies a file of hostname translations.
.TP 23
.B ARES_FLAG_NOCHECKRESP
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
response code or responses whose questions don't match the questions
in the request. Primarily useful for writing clients which might be
used to test or debug name servers.
.SH RETURN VALUES .SH RETURN VALUES
.I ares_init \fIares_init(3)\fP can return any of the following values:
or
.I ares_init_options
can return any of the following values:
.TP 14 .TP 14
.B ARES_SUCCESS .B ARES_SUCCESS
Initialization succeeded. Initialization succeeded.
...@@ -211,6 +68,7 @@ please see the ...@@ -211,6 +68,7 @@ please see the
.BR resolv.conf (5) .BR resolv.conf (5)
manual page. manual page.
.SH SEE ALSO .SH SEE ALSO
.BR ares_init_options(3),
.BR ares_destroy(3), .BR ares_destroy(3),
.BR ares_dup(3), .BR ares_dup(3),
.BR ares_library_init(3), .BR ares_library_init(3),
......
...@@ -112,7 +112,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ...@@ -112,7 +112,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
ares_channel channel; ares_channel channel;
int i; int i;
int status = ARES_SUCCESS; int status = ARES_SUCCESS;
int status2;
struct timeval now; struct timeval now;
#ifdef CURLDEBUG #ifdef CURLDEBUG
...@@ -190,18 +189,17 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ...@@ -190,18 +189,17 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
* precedence to lowest. * precedence to lowest.
*/ */
if (status == ARES_SUCCESS) {
status = init_by_options(channel, options, optmask); status = init_by_options(channel, options, optmask);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS) {
DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n",
ares_strerror(status))); ares_strerror(status)));
/* If we fail to apply user-specified options, fail the whole init process */
goto done;
} }
if (status == ARES_SUCCESS) {
status = init_by_environment(channel); status = init_by_environment(channel);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n",
ares_strerror(status))); ares_strerror(status)));
}
if (status == ARES_SUCCESS) { if (status == ARES_SUCCESS) {
status = init_by_resolv_conf(channel); status = init_by_resolv_conf(channel);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
...@@ -213,13 +211,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ...@@ -213,13 +211,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
* No matter what failed or succeeded, seed defaults to provide * No matter what failed or succeeded, seed defaults to provide
* useful behavior for things that we missed. * useful behavior for things that we missed.
*/ */
status2 = init_by_defaults(channel); status = init_by_defaults(channel);
if (status2 != ARES_SUCCESS) { if (status != ARES_SUCCESS)
DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n",
ares_strerror(status))); ares_strerror(status)));
if (status == ARES_SUCCESS)
status = status2;
}
/* Generate random key */ /* Generate random key */
...@@ -232,6 +227,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ...@@ -232,6 +227,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
ares_strerror(status))); ares_strerror(status)));
} }
done:
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
{ {
/* Something failed; clean up memory we may have allocated. */ /* Something failed; clean up memory we may have allocated. */
...@@ -350,8 +346,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options, ...@@ -350,8 +346,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
(*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS|
ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB|
ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS|
ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS) | ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS);
(channel->optmask & ARES_OPT_ROTATE); (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE);
/* Copy easy stuff */ /* Copy easy stuff */
options->flags = channel->flags; options->flags = channel->flags;
...@@ -447,6 +443,8 @@ static int init_by_options(ares_channel channel, ...@@ -447,6 +443,8 @@ static int init_by_options(ares_channel channel,
channel->ndots = options->ndots; channel->ndots = options->ndots;
if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1) if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1)
channel->rotate = 1; channel->rotate = 1;
if ((optmask & ARES_OPT_NOROTATE) && channel->rotate == -1)
channel->rotate = 0;
if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1) if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1)
channel->udp_port = htons(options->udp_port); channel->udp_port = htons(options->udp_port);
if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1)
...@@ -520,13 +518,14 @@ static int init_by_options(ares_channel channel, ...@@ -520,13 +518,14 @@ static int init_by_options(ares_channel channel,
} }
/* copy sortlist */ /* copy sortlist */
if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) && if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1)) {
(options->nsort>0)) { if (options->nsort > 0) {
channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern));
if (!channel->sortlist) if (!channel->sortlist)
return ARES_ENOMEM; return ARES_ENOMEM;
for (i = 0; i < options->nsort; i++) for (i = 0; i < options->nsort; i++)
channel->sortlist[i] = options->sortlist[i]; channel->sortlist[i] = options->sortlist[i];
}
channel->nsort = options->nsort; channel->nsort = options->nsort;
} }
...@@ -1623,7 +1622,7 @@ static int config_lookup(ares_channel channel, const char *str, ...@@ -1623,7 +1622,7 @@ static int config_lookup(ares_channel channel, const char *str,
channel->lookups = ares_strdup(lookups); channel->lookups = ares_strdup(lookups);
return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM;
} }
#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ #endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */
#ifndef WATT32 #ifndef WATT32
static int config_nameserver(struct server_state **servers, int *nservers, static int config_nameserver(struct server_state **servers, int *nservers,
......
.so man3/ares_init.3 .\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2010 by Daniel Stenberg
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.TH ARES_INIT 3 "5 March 2010"
.SH NAME
ares_init_options \- Initialize a resolver channel
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_init_options(ares_channel *\fIchannelptr\fP,
struct ares_options *\fIoptions\fP,
int \fIoptmask\fP)
.fi
.SH DESCRIPTION
The \fBares_init_options(3)\fP function initializes a communications channel
for name service lookups. If it returns successfully,
\fBares_init_options(3)\fP will set the variable pointed to by
\fIchannelptr\fP to a handle used to identify the name service channel. The
caller should invoke \fIares_destroy(3)\fP on the handle when the channel is
no longer needed.
The \fIoptmask\fP parameter generally specifies which fields in the structure pointed to
by \fIoptions\fP are set, as follows:
.TP 18
.B ARES_OPT_FLAGS
.B int \fIflags\fP;
.br
Flags controlling the behavior of the resolver. See below for a
description of possible flag values.
.TP 18
.B ARES_OPT_TIMEOUT
.B int \fItimeout\fP;
.br
The number of seconds each name server is given to respond to a query on the
first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. This option is being deprecated by
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
.TP 18
.B ARES_OPT_TIMEOUTMS
.B int \fItimeout\fP;
.br
The number of milliseconds each name server is given to respond to a query on
the first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. Note that this option is specified with the same
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
that tell c-ares how to interpret the number. This option was added in c-ares
1.5.2.
.TP 18
.B ARES_OPT_TRIES
.B int \fItries\fP;
.br
The number of tries the resolver will try contacting each name server
before giving up. The default is four tries.
.TP 18
.B ARES_OPT_NDOTS
.B int \fIndots\fP;
.br
The number of dots which must be present in a domain name for it to be
queried for "as is" prior to querying for it with the default domain
extensions appended. The default value is 1 unless set otherwise by
resolv.conf or the RES_OPTIONS environment variable.
.TP 18
.B ARES_OPT_UDP_PORT
.B unsigned short \fIudp_port\fP;
.br
The port to use for queries over UDP, in network byte order.
The default value is 53 (in network byte order), the standard name
service port.
.TP 18
.B ARES_OPT_TCP_PORT
.B unsigned short \fItcp_port\fP;
.br
The port to use for queries over TCP, in network byte order.
The default value is 53 (in network byte order), the standard name
service port.
.TP 18
.B ARES_OPT_SERVERS
.B struct in_addr *\fIservers\fP;
.br
.B int \fInservers\fP;
.br
The list of IPv4 servers to contact, instead of the servers specified in
resolv.conf or the local named. In order to allow specification of either
IPv4 or IPv6 name servers, the
.BR ares_set_servers(3)
function must be used instead.
.TP 18
.B ARES_OPT_DOMAINS
.B char **\fIdomains\fP;
.br
.B int \fIndomains\fP;
.br
The domains to search, instead of the domains specified in resolv.conf
or the domain derived from the kernel hostname variable.
.TP 18
.B ARES_OPT_LOOKUPS
.B char *\fIlookups\fP;
.br
The lookups to perform for host queries.
.I lookups
should be set to a string of the characters "b" or "f", where "b"
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
.TP 18
.B ARES_OPT_SOCK_STATE_CB
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
.br
.B void *\fIsock_state_cb_data\fP;
.br
A callback function to be invoked when a socket changes state.
.I s
will be passed the socket whose state has changed;
.I read
will be set to true if the socket should listen for read events, and
.I write
will be set to true if the socket should listen for write events.
The value of
.I sock_state_cb_data
will be passed as the
.I data
argument.
.TP 18
.B ARES_OPT_SORTLIST
.B struct apattern *\fIsortlist\fP;
.br
.B int \fInsort\fP;
.br
A list of IP address ranges that specifies the order of preference that
results from \fIares_gethostbyname\fP should be returned in. Note that
this can only be used with a sortlist retrieved via
\fBares_save_options(3)\fP (because
.B struct apattern
is opaque); to set a fresh sort list, use \fBares_set_sortlist(3)\fP.
.TP 18
.B ARES_OPT_SOCK_SNDBUF
.B int \fIsocket_send_buffer_size\fP;
.br
The send buffer size to set for the socket.
.TP 18
.B ARES_OPT_SOCK_RCVBUF
.B int \fIsocket_receive_buffer_size\fP;
.br
The receive buffer size to set for the socket.
.TP 18
.B ARES_OPT_EDNSPSZ
.B int \fIednspsz\fP;
.br
The message size to be advertized in EDNS; only takes effect if the
.B ARES_FLAG_EDNS
flag is set.
.br
.PP
The \fIoptmask\fP parameter also includes options without a corresponding
field in the
.B ares_options
structure, as follows:
.TP 23
.B ARES_OPT_ROTATE
Perform round-robin selection of the nameservers configured for the channel
for each resolution.
.TP 23
.B ARES_OPT_NOROTATE
Do not perform round-robin nameserver selection; always use the list of
nameservers in the same order.
.PP
The
.I flags
field should be the bitwise or of some subset of the following values:
.TP 23
.B ARES_FLAG_USEVC
Always use TCP queries (the "virtual circuit") instead of UDP
queries. Normally, TCP is only used if a UDP query yields a truncated
result.
.TP 23
.B ARES_FLAG_PRIMARY
Only query the first server in the list of servers to query.
.TP 23
.B ARES_FLAG_IGNTC
If a truncated response to a UDP query is received, do not fall back
to TCP; simply continue on with the truncated response.
.TP 23
.B ARES_FLAG_NORECURSE
Do not set the "recursion desired" bit on outgoing queries, so that the name
server being contacted will not try to fetch the answer from other servers if
it doesn't know the answer locally. Be aware that ares will not do the
recursion for you. Recursion must be handled by the application calling ares
if \fIARES_FLAG_NORECURSE\fP is set.
.TP 23
.B ARES_FLAG_STAYOPEN
Do not close communications sockets when the number of active queries
drops to zero.
.TP 23
.B ARES_FLAG_NOSEARCH
Do not use the default search domains; only query hostnames as-is or
as aliases.
.TP 23
.B ARES_FLAG_NOALIASES
Do not honor the HOSTALIASES environment variable, which normally
specifies a file of hostname translations.
.TP 23
.B ARES_FLAG_NOCHECKRESP
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
response code or responses whose questions don't match the questions
in the request. Primarily useful for writing clients which might be
used to test or debug name servers.
.TP 23
.B ARES_FLAG_EDNS
Include an EDNS pseudo-resource record (RFC 2671) in generated requests.
.SH RETURN VALUES
\fBares_init_options(3)\fP can return any of the following values:
.TP 14
.B ARES_SUCCESS
Initialization succeeded.
.TP 14
.B ARES_EFILE
A configuration file could not be read.
.TP 14
.B ARES_ENOMEM
The process's available memory was exhausted.
.TP 14
.B ARES_ENOTINITIALIZED
c-ares library initialization not yet performed.
.SH NOTES
When initializing from
.B /etc/resolv.conf,
\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives
to allow lookups of short names relative to the domains specified. The
\fIdomain\fP and \fIsearch\fP directives override one another. If more that
one instance of either \fIdomain\fP or \fIsearch\fP directives is specified,
the last occurrence wins. For more information, please see the
.BR resolv.conf (5)
manual page.
.SH SEE ALSO
.BR ares_init(3),
.BR ares_destroy(3),
.BR ares_dup(3),
.BR ares_library_init(3),
.BR ares_save_options(3),
.BR ares_set_servers(3),
.BR ares_set_sortlist(3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2010 by Daniel Stenberg.
...@@ -47,16 +47,16 @@ struct addrinfo ...@@ -47,16 +47,16 @@ struct addrinfo
#endif #endif
#ifndef NS_IN6ADDRSZ #ifndef NS_IN6ADDRSZ
#if SIZEOF_STRUCT_IN6_ADDR == 0 #ifndef HAVE_STRUCT_IN6_ADDR
/* We cannot have it set to zero, so we pick a fixed value here */ /* We cannot have it set to zero, so we pick a fixed value here */
#define NS_IN6ADDRSZ 16 #define NS_IN6ADDRSZ 16
#else #else
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR #define NS_IN6ADDRSZ sizeof(struct in6_addr)
#endif #endif
#endif #endif
#ifndef NS_INADDRSZ #ifndef NS_INADDRSZ
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR #define NS_INADDRSZ sizeof(struct in_addr)
#endif #endif
#ifndef NS_INT16SZ #ifndef NS_INT16SZ
......
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
ares_library_init \- c-ares library initialization ares_library_init \- c-ares library initialization
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B int ares_library_init(int \fIflags\fP) int ares_library_init(int \fIflags\fP)
.B int ares_library_init_mem(int \fIflags\fP, void *(*\fIamalloc\fP)(size_t), void (*\fIafree\fP)(void *))
.PP int ares_library_init_mem(int \fIflags\fP,
.B cc file.c -lcares void *(*\fIamalloc\fP)(size_t),
void (*\fIafree\fP)(void *ptr),
void (*\fIarealloc\fP)(void *ptr, size_t size))
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
...@@ -54,9 +56,9 @@ familiar with it and trying to control some internal c-ares feature. ...@@ -54,9 +56,9 @@ familiar with it and trying to control some internal c-ares feature.
.PP .PP
The The
.B ares_library_init_mem .B ares_library_init_mem
function allows the caller to provide memory management function allows the caller to provide memory management functions that the
functions that the c-ares library will be use instead of \fImalloc(3)\fP and c-ares library will be use instead of \fImalloc(3)\fP, \fIfree(3)\fP and
\fIfree(3)\fP. \fIrealloc(3)\fP.
.PP .PP
.B This function is not thread safe. .B This function is not thread safe.
You have to call it once the program has started, but this call must be done You have to call it once the program has started, but this call must be done
......
...@@ -152,6 +152,7 @@ void ares_library_cleanup(void) ...@@ -152,6 +152,7 @@ void ares_library_cleanup(void)
ares_init_flags = ARES_LIB_INIT_NONE; ares_init_flags = ARES_LIB_INIT_NONE;
ares_malloc = malloc; ares_malloc = malloc;
ares_realloc = realloc;
ares_free = free; ares_free = free;
} }
...@@ -164,5 +165,3 @@ int ares_library_initialized(void) ...@@ -164,5 +165,3 @@ int ares_library_initialized(void)
#endif #endif
return ARES_SUCCESS; return ARES_SUCCESS;
} }
...@@ -40,42 +40,22 @@ ...@@ -40,42 +40,22 @@
#include "ares_nowarn.h" #include "ares_nowarn.h"
#if (SIZEOF_SHORT == 2) #ifndef HAVE_LIMITS_H
/* systems without <limits.h> we guess have 16 bit shorts, 32bit ints and
32bit longs */
# define CARES_MASK_SSHORT 0x7FFF # define CARES_MASK_SSHORT 0x7FFF
# define CARES_MASK_USHORT 0xFFFF # 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
#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_SINT 0x7FFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFF # define CARES_MASK_UINT 0xFFFFFFFF
#elif (SIZEOF_INT == 8) # define CARES_MASK_SLONG 0x7FFFFFFFL
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF # define CARES_MASK_ULONG 0xFFFFFFFFUL
# 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
#ifndef HAVE_LIMITS_H
/* systems without <limits.h> we guess have 32 bit longs */
#define CARES_MASK_SLONG 0x7FFFFFFFL
#define CARES_MASK_ULONG 0xFFFFFFFFUL
#else #else
#define CARES_MASK_ULONG ULONG_MAX # define CARES_MASK_SSHORT SHRT_MAX
#define CARES_MASK_SLONG LONG_MAX # define CARES_MASK_USHORT USHRT_MAX
# define CARES_MASK_SINT INT_MAX
# define CARES_MASK_UINT UINT_MAX
# define CARES_MASK_SLONG LONG_MAX
# define CARES_MASK_ULONG ULONG_MAX
#endif #endif
/* /*
......
...@@ -391,7 +391,6 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, ...@@ -391,7 +391,6 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds,
*/ */
process_answer(channel, server->tcp_buffer, server->tcp_length, process_answer(channel, server->tcp_buffer, server->tcp_length,
i, 1, now); i, 1, now);
if (server->tcp_buffer)
ares_free(server->tcp_buffer); ares_free(server->tcp_buffer);
server->tcp_buffer = NULL; server->tcp_buffer = NULL;
server->tcp_lenbuf_pos = 0; server->tcp_lenbuf_pos = 0;
......
...@@ -73,11 +73,6 @@ ...@@ -73,11 +73,6 @@
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
#endif #endif
#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
#endif
/* /*
* Macros private to this header file. * Macros private to this header file.
*/ */
...@@ -94,7 +89,7 @@ ...@@ -94,7 +89,7 @@
typedef char typedef char
__cares_rule_02__ __cares_rule_02__
[CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; [CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))];
/* /*
* Verify at compile time that the size of ares_socklen_t as reported * Verify at compile time that the size of ares_socklen_t as reported
......
...@@ -40,7 +40,7 @@ to free any associated memory. ...@@ -40,7 +40,7 @@ to free any associated memory.
can return any of the following values: can return any of the following values:
.TP 15 .TP 15
.B ARES_SUCCESS .B ARES_SUCCESS
The channel data was successfuly stored The channel data was successfully stored
.TP 15 .TP 15
.B ARES_ENOMEM .B ARES_ENOMEM
The memory was exhausted The memory was exhausted
......
...@@ -60,7 +60,7 @@ IPv4-only name server usage. ...@@ -60,7 +60,7 @@ IPv4-only name server usage.
may return any of the following values: may return any of the following values:
.TP 15 .TP 15
.B ARES_SUCCESS .B ARES_SUCCESS
The name servers configuration was successfuly initialized. The name servers configuration was successfully initialized.
.TP 15 .TP 15
.B ARES_ENOMEM .B ARES_ENOMEM
The process's available memory was exhausted. The process's available memory was exhausted.
......
...@@ -43,7 +43,7 @@ particular nameserver. ...@@ -43,7 +43,7 @@ particular nameserver.
This function may return any of the following values: This function may return any of the following values:
.TP 15 .TP 15
.B ARES_SUCCESS .B ARES_SUCCESS
The name servers configuration was successfuly initialized. The name servers configuration was successfully initialized.
.TP 15 .TP 15
.B ARES_ENOMEM .B ARES_ENOMEM
The process's available memory was exhausted. The process's available memory was exhausted.
......
...@@ -39,7 +39,7 @@ with the ones given in the configuration string. ...@@ -39,7 +39,7 @@ with the ones given in the configuration string.
may return any of the following values: may return any of the following values:
.TP 15 .TP 15
.B ARES_SUCCESS .B ARES_SUCCESS
The sortlist configuration was successfuly initialized. The sortlist configuration was successfully initialized.
.TP 15 .TP 15
.B ARES_ENOMEM .B ARES_ENOMEM
The process's available memory was exhausted. The process's available memory was exhausted.
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
#define ARES__VERSION_H #define ARES__VERSION_H
/* This is the global package copyright */ /* This is the global package copyright */
#define ARES_COPYRIGHT "2004 - 2013 Daniel Stenberg, <daniel@haxx.se>." #define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 11 #define ARES_VERSION_MINOR 12
#define ARES_VERSION_PATCH 0 #define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH)) (ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.11.0" #define ARES_VERSION_STR "1.12.0"
#if (ARES_VERSION >= 0x010700) #if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1 # define CARES_HAVE_ARES_LIBRARY_INIT 1
......
/* Copyright (C) 2009 by Daniel Stenberg /* Copyright (C) 2009-2016 by Daniel Stenberg
* *
* Permission to use, copy, modify, and distribute this * Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without * software and its documentation for any purpose and without
...@@ -39,7 +39,7 @@ BEGIN ...@@ -39,7 +39,7 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "The c-ares library, http://c-ares.haxx.se/\0" VALUE "CompanyName", "The c-ares library, https://c-ares.haxx.se/\0"
#if defined(DEBUGBUILD) || defined(_DEBUG) #if defined(DEBUGBUILD) || defined(_DEBUG)
VALUE "FileDescription", "c-ares Debug Shared Library\0" VALUE "FileDescription", "c-ares Debug Shared Library\0"
VALUE "FileVersion", ARES_VERSION_STR "\0" VALUE "FileVersion", ARES_VERSION_STR "\0"
...@@ -54,7 +54,7 @@ BEGIN ...@@ -54,7 +54,7 @@ BEGIN
VALUE "ProductName", "The c-ares library\0" VALUE "ProductName", "The c-ares library\0"
VALUE "ProductVersion", ARES_VERSION_STR "\0" VALUE "ProductVersion", ARES_VERSION_STR "\0"
VALUE "LegalCopyright", "© " ARES_COPYRIGHT "\0" VALUE "LegalCopyright", "© " ARES_COPYRIGHT "\0"
VALUE "License", "http://c-ares.haxx.se/license.html\0" VALUE "License", "https://c-ares.haxx.se/license.html\0"
END END
END END
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
#define NEED_MALLOC_H 1 #define NEED_MALLOC_H 1
#define RETSIGTYPE void #define RETSIGTYPE void
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_SIZE_T 4
#define TIME_WITH_SYS_TIME 1 #define TIME_WITH_SYS_TIME 1
/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ /* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */
......
...@@ -234,19 +234,6 @@ ...@@ -234,19 +234,6 @@
/* TYPE SIZES */ /* TYPE SIZES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define to the size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* Define to the size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* Define to the size of `size_t', as computed by sizeof. */
#if defined(_WIN64)
# define SIZEOF_SIZE_T 8
#else
# define SIZEOF_SIZE_T 4
#endif
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* STRUCT RELATED */ /* STRUCT RELATED */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
......
This diff is collapsed.
AC_PREREQ(2.57) AC_PREREQ(2.57)
dnl Version not hardcoded here. Fetched later from ares_version.h dnl Version not hardcoded here. Fetched later from ares_version.h
AC_INIT([c-ares], [1.11.0], AC_INIT([c-ares], [1.12.0],
[c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares]) [c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
XC_OVR_ZZ50 XC_OVR_ZZ50
...@@ -82,6 +82,7 @@ dnl Get system canonical name ...@@ -82,6 +82,7 @@ dnl Get system canonical name
AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
XC_CHECK_PROG_CC XC_CHECK_PROG_CC
AX_CXX_COMPILE_STDCXX_11([noext],[optional])
XC_AUTOMAKE XC_AUTOMAKE
...@@ -481,12 +482,6 @@ AC_TYPE_SIZE_T ...@@ -481,12 +482,6 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME AC_HEADER_TIME
CURL_CHECK_STRUCT_TIMEVAL CURL_CHECK_STRUCT_TIMEVAL
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(time_t)
AC_CHECK_TYPE(long long, AC_CHECK_TYPE(long long,
[AC_DEFINE(HAVE_LONGLONG, 1, [AC_DEFINE(HAVE_LONGLONG, 1,
[Define to 1 if the compiler supports the 'long long' data type.])] [Define to 1 if the compiler supports the 'long long' data type.])]
...@@ -759,63 +754,6 @@ AC_CHECK_FUNCS([bitncmp \ ...@@ -759,63 +754,6 @@ AC_CHECK_FUNCS([bitncmp \
]) ])
AC_CHECK_SIZEOF(struct in6_addr, ,
[
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#endif
]
)
AC_CHECK_SIZEOF(struct in_addr, ,
[
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#endif
]
)
dnl Check if the getnameinfo function is available dnl Check if the getnameinfo function is available
dnl and get the types of five of its arguments. dnl and get the types of five of its arguments.
CURL_CHECK_FUNC_GETNAMEINFO CURL_CHECK_FUNC_GETNAMEINFO
...@@ -877,7 +815,29 @@ squeeze CARES_PRIVATE_LIBS ...@@ -877,7 +815,29 @@ squeeze CARES_PRIVATE_LIBS
XC_CHECK_BUILD_FLAGS XC_CHECK_BUILD_FLAGS
if test "x$cross_compiling" = "xno"; then AC_MSG_CHECKING([whether to build tests])
AC_ARG_ENABLE(tests,
AC_HELP_STRING([--enable-tests], [build test suite]),
[ build_tests="$enableval" ],
[ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
build_tests="yes"
else
build_tests="no"
fi
]
)
if test "x$build_tests" = "xyes" ; then
if test "x$HAVE_CXX11" = "0" ; then
AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
fi
if test "x$cross_compiling" = "xyes" ; then
AC_MSG_ERROR([*** Tests not supported when cross compiling])
fi
fi
AC_MSG_RESULT([$build_tests])
if test "x$build_tests" = "xyes" ; then
AC_CONFIG_SUBDIRS([test]) AC_CONFIG_SUBDIRS([test])
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment