2 years agoCatch network failures from sendto earlier. master
Werner Koch [Wed, 9 Nov 2016 08:06:29 +0000 (09:06 +0100)]
Catch network failures from sendto earlier.

* src/adns.h (adns_s_netunreach): New.
(adns_s_netdown): New.
* src/general.c (struct sinfo): Add corresponding strings.
* src/transmit.c (adns__query_send): Bail out early on ENETUNREACH and

This patch will stop retrying sending UDP packets to an IP address for
which the sever can't reach the network or the interface is down.  A
common case for these errors are lost network connections (WLAN lost
or cable unplugged).  It does not make sense to keep on trying once
sendto returned one of these errors - it is unlikely that this will be
solved within the next 30 seconds (15 retries * 2s)

Signed-off-by: Werner Koch <>
2 years agobuild: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
Werner Koch [Wed, 13 Jul 2016 17:09:48 +0000 (19:09 +0200)]
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.

* build-aux/config.guess: Update.
* build-aux/config.sub: Update.

Signed-off-by: Werner Koch <>
2 years agow32: Silence const warning for select.
Werner Koch [Sat, 25 Jun 2016 15:28:27 +0000 (17:28 +0200)]
w32: Silence const warning for select.

* src/w32support.c (adns__sock_select): Use a copy of the timeout arg.

Signed-off-by: Werner Koch <>
3 years agoPost release updates
Werner Koch [Fri, 20 Nov 2015 14:32:22 +0000 (15:32 +0100)]
Post release updates


3 years agoRelease 1.4-g10-7.
Werner Koch [Fri, 20 Nov 2015 13:41:31 +0000 (14:41 +0100)]
Release 1.4-g10-7.

* Bump LT version to C5/A4/R0.

Signed-off-by: Werner Koch <>
3 years agow32: Fix printf format mismatch.
Werner Koch [Fri, 20 Nov 2015 12:26:35 +0000 (13:26 +0100)]
w32: Fix printf format mismatch.


3 years agow32: Make adns__sock_writev actually work.
Werner Koch [Fri, 20 Nov 2015 11:47:24 +0000 (12:47 +0100)]
w32: Make adns__sock_writev actually work.

* src/w32support.c (adns__sock_writev): No error checking for alloca

... and the old error checking was plainly wrong.

Signed-off-by: Werner Koch <>
3 years agoAlso try port 9150 in Tor mode.
Werner Koch [Fri, 20 Nov 2015 12:15:40 +0000 (13:15 +0100)]
Also try port 9150 in Tor mode.

* src/w32support.c (ECONNREFUSED):  Define if missing.
(adns__sock_wsa2errno): Map WSAECONNREFUSED.
* src/event.c (socks_connect): Try port 9150.

The Tor browser uses this port.

Signed-off-by: Werner Koch <>
3 years agow32: Allow building with older toolchains.
Werner Koch [Thu, 19 Nov 2015 10:41:03 +0000 (11:41 +0100)]
w32: Allow building with older toolchains.

* src/event.c [W32]: Add replaement errno values.

The mingw-w64 toolchain in Debian Wheezy seems to miss a few error

Signed-off-by: Werner Koch <>
3 years agoAllow SOCKS5 authentication with username/password.
Werner Koch [Mon, 9 Nov 2015 17:10:27 +0000 (18:10 +0100)]
Allow SOCKS5 authentication with username/password.

* src/event.c (socks_connect): Implemedn authentication method 2.

The credentials are given by the new config option adns_sockscred.
Changing the credentials is an indication to Tor to use a new circuit.
Tor ignore the actual values.

Signed-off-by: Werner Koch <>
3 years agoMake handling of returned SOCKS bound address more robust.
Werner Koch [Mon, 9 Nov 2015 17:08:03 +0000 (18:08 +0100)]
Make handling of returned SOCKS bound address more robust.

* src/event.c (socks_connect): Allow proxy to return a v6 address
instead of the provided v4 and vice versa.

The specs say nothing about this but doing it this way is likely more
robust that assuming the same family will be returned.

Signed-off-by: Werner Koch <>
3 years agoAdd macro to safely clear memory.
Werner Koch [Mon, 9 Nov 2015 17:01:43 +0000 (18:01 +0100)]
Add macro to safely clear memory.

* src/internal.h (WIPEMEMORY): New.

This kind of platform neutral code has been in use by GnuPG and
Libgcrypt for ages.  I am still waiting for some C committee f^D
experts to figure that this makes use of undefined behaviour for
volatile and they tell their optimizing-for-the-flat-world compiler
to remove such code and thereby unveil passwords in memory (which
actually happened for the standard memset).

Signed-off-by: Werner Koch <>
3 years agoAdd config options adns_tormode and adns_sockscred.
Werner Koch [Sun, 8 Nov 2015 17:57:56 +0000 (18:57 +0100)]
Add config options adns_tormode and adns_sockscred.

* src/internal.h (struct adns__state): Add field "sockscred".
* src/setup.c (init_begin): Clear SOCKSCRED.
(init_finish): Free SOCKSCRED.
(ccf_options): Implement new options.
* src/adns.h: Describe options.

Signed-off-by: Werner Koch <>
3 years agosrc/types.c: Fix up the table-of-contents comments.
Mark Wooding [Mon, 9 Jun 2014 09:41:33 +0000 (10:41 +0100)]
src/types.c: Fix up the table-of-contents comments.

Cheesy but useful sed(1) rune:

sed -n '
  /order of sections/,/\*\//d
  /^ \* _/s///p
  /^static \+[a-z0-9_]\+ \+\**\([0-9a-z_]\+\).*$/s//  \1/p'

Signed-off-by: Mark Wooding <>
Resolved conflicts:
src/types.c - keep my own v6 parser.

3 years agoclient/adh-query.c: Surprising comma rather than semicolon.
Mark Wooding [Sat, 7 Jun 2014 23:01:46 +0000 (00:01 +0100)]
client/adh-query.c: Surprising comma rather than semicolon.

This doesn't change the meaning of the code, but it's really surprising.

Signed-off-by: Mark Wooding <>
Resolved conflicts:
client/adh-query.c - white space

3 years agosrc/internal.h: Delete decoy type `rr_align'.
Mark Wooding [Sat, 7 Jun 2014 17:02:53 +0000 (18:02 +0100)]
src/internal.h: Delete decoy type `rr_align'.

The droid you were looking for is called `union maxalign'.

Signed-off-by: Mark Wooding <>
3 years agosrc/types.c: Remove some unused macros.
Mark Wooding [Sat, 31 May 2014 14:05:17 +0000 (15:05 +0100)]
src/types.c: Remove some unused macros.

Signed-off-by: Mark Wooding <>
3 years agoAdd lost config script.
Werner Koch [Tue, 20 Oct 2015 16:39:57 +0000 (18:39 +0200)]
Add lost config script.

* src/ New.  Content was lost.
(adns-conf): New ac_config_command.

3 years agoAdd flag adns_if_tormode to provide a basic TOR mode.
Werner Koch [Tue, 20 Oct 2015 12:48:23 +0000 (14:48 +0200)]
Add flag adns_if_tormode to provide a basic TOR mode.

* src/adns.h (adns_if_tormode): New.
* src/query.c (adns_submit): For a VC in tormode.
(adns_submit_reverse_any): Ditto.
(adns_synchronous): Ditto.
* src/event.c (use_socks_p, socks_connect): New.  Based on code from
(adns__tcp_tryconnect): Move setnonblock after the init of ADDR.  Call
socks_connect if needed.

* client/adh-opts.c (global_options): Add "--use-tor"
(ov_tormode): New.
* client/adnshost.h (ov_tormode): New declaration.
* client/adh-query.c (ensure_adns_init): Enable TOR mode uf OV_TORMODE
is set.

This patch has the problem that connecting to the TOR server and more
important establishing the TOR connection will block.  Changing this
would require quite some report of the TCP code in ADNS.

In fact it has always been the case that when falling back to TCP mode
and the connect would have blocked the connection won't be established
but times outs.  There is no retry code for if connect returns with

To test the code this command can be used.

  adnshost --config 'nameserver' --use-tor NAME

Signed-off-by: Werner Koch <>
3 years agoSilence compiler warnings.
Werner Koch [Tue, 20 Oct 2015 06:24:36 +0000 (08:24 +0200)]
Silence compiler warnings.

* regress/hplayback.c (Q_vb): Remove unused var r.
* src/event.c (tcp_close): Remove unused var serv.
* src/reply.c (adns__procdgram): Remove unused var arstart.
* src/internal.h (GET_W, GTE_L): Do not return arg tv; it is not used.

Also remove some trailing white space.

Signed-off-by: Werner Koch <>
3 years agoPost release updates.
Werner Koch [Mon, 13 Apr 2015 10:05:08 +0000 (12:05 +0200)]
Post release updates.


3 years agoRelease 1.4-g10-6 adns-1.4-g10-6
Werner Koch [Mon, 13 Apr 2015 09:57:58 +0000 (11:57 +0200)]
Release 1.4-g10-6

* Set LT version to C4/A3/R3.

4 years agoUse copies of the source file in client and regress.
Werner Koch [Tue, 3 Feb 2015 15:55:47 +0000 (16:55 +0100)]
Use copies of the source file in client and regress.

* src/source.list: Remove.
* src/ (adnssources): Directly insert names.
* client/ (sources_from_src): New.
($(PROGRAMS)): Depend on sources_from_src.
* regress/ (sources_from_src): New.
(sources_from_client): New.
($(sources_from_src)): Copy them.
($(sources_from_client)): Ditto.

The old hack does not work anmore with automake 1.14.  Thus we use
this ugly scheme.

4 years agow32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
Werner Koch [Tue, 3 Feb 2015 14:33:28 +0000 (15:33 +0100)]
w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* src/ (extra_ltoptions): New.
(libadns_la_LDFLAGS): Use it.

Since gcc 4.8 there is a regression in that plain C programs may link
to libgcc_s.a which has a dependency on libgcc_s_sjlj.dll.  This is
for example triggered by using long long arithmetic on a 32 bit
Windows (e.g symbol __udivdi3).

4 years agoRequire the use of automake 1.14 and update build-aux file.
Werner Koch [Tue, 3 Feb 2015 14:32:23 +0000 (15:32 +0100)]
Require the use of automake 1.14 and update build-aux file.

4 years agoPost release updates
Werner Koch [Fri, 12 Dec 2014 09:08:04 +0000 (10:08 +0100)]
Post release updates


4 years agoRelease 1.4-g10-5. adns-1.4-g10-5
Werner Koch [Fri, 12 Dec 2014 09:01:50 +0000 (10:01 +0100)]
Release 1.4-g10-5.

4 years agoModernize the build system
Werner Koch [Fri, 12 Dec 2014 09:01:02 +0000 (10:01 +0100)]
Modernize the build system

* (AUTOMAKE_OPTIONS): Move to ...
(LT_PREREQ, LT_INIT, LT_LANG): Use modern libtool stuff.

The primary reason for this is that the old libtool messed up Windows
.def files.  The new versions, taken ffrom libgpg-error, has a patch
for this.

4 years agoRelease adns-1.4-g1-4. adns-1.4-g10-4
Werner Koch [Sat, 5 Apr 2014 07:55:02 +0000 (09:55 +0200)]
Release adns-1.4-g1-4.

4 years agoAdd option -f to adnslogres.
Werner Koch [Sat, 5 Apr 2014 07:53:07 +0000 (09:53 +0200)]
Add option -f to adnslogres.

5 years agoadnslogres: Change -P to also map unresolved addresses.
Werner Koch [Wed, 19 Mar 2014 21:41:52 +0000 (22:41 +0100)]
adnslogres: Change -P to also map unresolved addresses.

5 years agoadnslogres: Support IPv6 and improve privacy mode.
Werner Koch [Wed, 19 Mar 2014 15:35:52 +0000 (16:35 +0100)]
adnslogres: Support IPv6 and improve privacy mode.

* client/adnslogres.c: Add assert.h.
(expand_v6): New.
(ipaddr2domain): Rewrite.
(printline): Print truncated IP if resolving failed and append 4 or 6
to indicate the used protocol.
(readline): Request raw ptr vor v6.  Handle new parameters.
(main): Add option -x.

5 years agoPost release version number bump.
Jedi [Wed, 24 Apr 2013 17:28:41 +0000 (19:28 +0200)]
Post release version number bump.


5 years agoRelease 1.4-g10-3. adns-1.4-g10-3
Jedi [Wed, 24 Apr 2013 16:34:14 +0000 (18:34 +0200)]
Release 1.4-g10-3.

* Set LT version to C4/A3/R1.

5 years agow32: Support AAAA support.
Jedi [Wed, 24 Apr 2013 16:24:56 +0000 (18:24 +0200)]
w32: Support AAAA support.

* src/w32inet.c: New.  Taken from gnulib lib/inet_ntop.c.  Modified
for Windows only use.
(inet_ntop): Rename to adns__inet_ntop.
* src/ (w32src): Add file.
* src/types.c (cs_in6addr) [W32]: Use adns__inet_ntop.

inet_ntop taken from
gnulib commit c042abf1678115fe6ab736a1c12a83ff395ea7c4

5 years agoAdd missing ChangeLog entries.
Jedi [Wed, 24 Apr 2013 14:51:21 +0000 (16:51 +0200)]
Add missing ChangeLog entries.


Taken from the git log.

5 years agow32: Switch to i686-w64-mingw32 as default compiler.
Jedi [Wed, 24 Apr 2013 14:49:10 +0000 (16:49 +0200)]
w32: Switch to i686-w64-mingw32 as default compiler.


Also fix VPATH builds.

6 years agoAutomagically provide a beta version number.
Werner Koch [Fri, 11 May 2012 16:44:02 +0000 (18:44 +0200)]
Automagically provide a beta version number.

Also fixed the extra file version for Windows.

6 years agoSupport command line options -t aaaa.
Werner Koch [Fri, 11 May 2012 14:22:54 +0000 (16:22 +0200)]
Support command line options -t aaaa.

* client/adh-main.c (of_type): Add adns_r_aaaa.

6 years agoAdd support for AAAA records.
Werner Koch [Fri, 11 May 2012 14:21:02 +0000 (16:21 +0200)]
Add support for AAAA records.

* src/adns.h (adns_rrtype): Add adns_r_aaaa.
(adns_answer): Add member in6addr.
* src/internal.h (adns__state): Change sortlist struct to allow for v6
* src/check.c (checkc_global): Fix for v6 sortlist.
* src/setup.c (ccf_sortlist): Mark entries as v4.
* src/types.c (search_sortlist): Ignore v6 addresses.
(pa_in6addr, search_sortlist6, dip_in6addr, di_in6addr)
(cs_in6addr): New.
(typeinfos): Add description for the AAAA record.

I am not sure whether the sortlist feature makes sense for v6.
Although I implemented the data structures and code, there is
currently no code to fill the sortlist with v6 addresses.

6 years agoFix class A detection for the sortlist.
Werner Koch [Fri, 11 May 2012 14:11:11 +0000 (16:11 +0200)]
Fix class A detection for the sortlist.

* src/setup.c (ccf_sortlist): Mask BASELOCAL and 0 or 1.

6 years agoIgnore output from regression tests.
Werner Koch [Fri, 11 May 2012 14:23:33 +0000 (16:23 +0200)]
Ignore output from regression tests.


6 years agoRemove trailing white space.
Werner Koch [Fri, 11 May 2012 09:32:31 +0000 (11:32 +0200)]
Remove trailing white space.


8 years agoAdd privacy feature to adnslogres
Werner Koch [Mon, 14 Mar 2011 13:56:57 +0000 (14:56 +0100)]
Add privacy feature to adnslogres

The option -P prints of successfully looked up DNS names in the format


where P is the literal character 'p', H is a hex digit and T is the
top level domain name.  The hex digits are the truncated hash value of
the entire domain name.  To later lookups impossible the option -S
allows to gives a salt value for this run.

8 years agoAdd .gitignore and libtool files
Werner Koch [Mon, 14 Mar 2011 13:32:58 +0000 (14:32 +0100)]
Add .gitignore and libtool files

8 years agoInitial import of adns-1.4-g10-2. adns-1.4-g10-2
Werner Koch [Mon, 27 Dec 2010 10:15:08 +0000 (11:15 +0100)]
Initial import of adns-1.4-g10-2.

  The old Windows port of adns did not worked very well (tcp
  connections have probably never been used) and it was not possible
  to build it from a POSIX box.  To make the porting and maintaining
  easier the build system has been updated to make use of automake and
  libtool.  Adding a bit of windows support was then easy.