Default number of dns retries doubled

Ángel González
Fri Aug 16 20:56:00 GMT 2013

On 16/08/13 20:34, Carlos O'Donell wrote:
> You'll have to dig into the code to see why it's sending multiple requests.
> If you can put together a reproducer (usually a test program,
> /etc/resolv.conf, and a bind config) that we can run on a single
> system that would be great.
> Cheers,
> Carlos.
Ok, it turns out to be really silly.
Checking the glibc functions, res_ninit() does indeed initialize retry 
but res_init() does its own initialization hardcoding a 4 on that field:
> _res.retry = 4;

It seems to have been this way since b43b13ac25, which introduced the 
set to 2 while keeping the line hardcoding it to 4 (although moved from 
to res_libc.c)

And that line goes back to the original 1995 commit 28f540f4.

So I guess RES_DFLRETRY should be changed to 4 (and the 4 to the 
constant), to keep
the historical behavior. It will be a change for programs calling 
res_ninit() directly, but
less intrusive than changing the res_init() default used on almost every 
program (although I wonder how many systems out there work with 4 
attempts but
would fail with 2, probably few, but there's the possibility on systems 
with an high
packet drop).

More information about the Libc-help mailing list