This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Default number of dns retries doubled
- From: Ángel González <keisial at gmail dot com>
- To: Carlos O'Donell <carlos at systemhalted dot org>, libc-help <libc-help at sourceware dot org>
- Cc: aj at suse dot de
- Date: Fri, 16 Aug 2013 23:02:10 +0200
- Subject: Re: Default number of dns retries doubled
- References: <520E0F55 dot 6020500 at gmail dot com> <CAE2sS1h0bHsspzd+MG1Z+v+hmkyNYtP-E9_nZoQkxqdshnagLA at mail dot gmail dot com> <520E560E dot 7040204 at gmail dot com> <CAE2sS1jQFquXfsp5PFGwf+BvzQLJ1enem1nsi1QsWtXWg2g29Q at mail dot gmail dot com>
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
to RES_DFLRETRY (2)
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
RES_DFLRETRY
set to 2 while keeping the line hardcoding it to 4 (although moved from
res_init.c
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
networked
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).