Index | Thread | Search

From:
"Theo de Raadt" <deraadt@openbsd.org>
Subject:
Re: Maximum number of nameservers in resolv.conf
To:
Otto Moerbeek <otto@drijf.net>
Cc:
Renaud Allard <renaud@allard.it>, Theo Buehler <tb@theobuehler.org>, tech@openbsd.org
Date:
Wed, 29 Jan 2025 08:25:38 -0700

Download raw body.

Thread
Otto Moerbeek <otto@drijf.net> wrote:

> On Tue, Jan 28, 2025 at 03:31:41PM +0100, Renaud Allard wrote:
> 
> > 
> > 
> > On 1/28/25 3:29 PM, Theo Buehler wrote:
> > > On Tue, Jan 28, 2025 at 03:26:48PM +0100, Renaud Allard wrote:
> > > > Hello,
> > > > 
> > > > The man page of resolv.conf states:
> > > > "Up to ASR_MAXNS (currently 5) name servers may be listed"
> > > > 
> > > > I cannot find any value for ASR_MAXNS in /usr/include
> > > 
> > > lib/libc/asr/asr_private.h:#define ASR_MAXNS	5
> > > 
> > 
> > Thanks for the fast reply. But then, what's the purpose of the MAXNS limit
> > in resolv.h? Shouldn't it be set on 5 too?
> > 
> > > > 
> > > > But /usr/include/resolv.h contains:
> > > > "#define   MAXNS                   3       /* max # name servers we'll track
> > > > */"
> > > > 
> 
> MAXNS is the numebr of NS actually used from the list.
> 
> I don't think upping MAXNS to 5 is useful, as the timeouts will
> accumulate to very high values. 
> 
> We only implement try in-order, but some implementations allow
> randomization of NS used. In that case the # of listed and the number
> used can differ in a meaningful way.

Right.

I guess the question is why does the OP want a different number.

The value is not publically exposed, because noone should code to it.
It's a detail that applications should not interact with.  It's not
part of the interface, and the behaviour of that number is also not in
play.