From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11207 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Sedich Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v2] attempts option not being respected in resolv.conf Date: Tue, 04 Apr 2017 02:08:08 +0000 Message-ID: References: <20170404003657.22843-1-stefan.sedich@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113c34d6eaf7a1054c4dbfba X-Trace: blaine.gmane.org 1491271727 30655 195.159.176.226 (4 Apr 2017 02:08:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Apr 2017 02:08:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11222-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 04 04:08:42 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cvDtX-0006WG-02 for gllmg-musl@m.gmane.org; Tue, 04 Apr 2017 04:08:31 +0200 Original-Received: (qmail 3634 invoked by uid 550); 4 Apr 2017 02:08:34 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3592 invoked from network); 4 Apr 2017 02:08:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=oFY2jdSsPqqlAR1XEfuqqkM3PW8d3u4dElKtO23H4fg=; b=tvHdjfTTf2F+9r1V9bKr8siaT71MB8KM7YrWU5MISMObmYFXiD6nP3BYJfCllcUvmx tqKKX2TNQ/ojqY4Dy4IuzGPCeAbqkHRLrOg/Aguu6Y7uI9ZOnczv+rFhJrGDCGRfAmGL HEe641t63Hyz+E6OihdmXGWBPWSTZmmY6iDIHuKpZQbjsUjZiC0+4itzY9dFT9kE3YzJ dYkD86cbtX2gswXG5lVVM2BWUYWb4OxV6sDw1Y1JkppKYBXImrwrvoYDsFGVrkEev0Oy oHWJPtJu279UrNVloivMNr5zf7KOoMsErbTNeAIAjioszFmVgAJS6Mx+jIS+q8QSkbN8 57Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=oFY2jdSsPqqlAR1XEfuqqkM3PW8d3u4dElKtO23H4fg=; b=mX4sE9adlP0nXlcpJAti7AeoX75PziTpqC+Un7L5Py9JKl97zyMnoRr6pqrPJka1nI RXHE6ztMPEEfq1Kz1nnWF1YZk2K+xA9GI6S8l2OkgWf2vBGGL6aGdSycUT36C8PEfh+P 171UdWFxcXq4nBRKCHyo+2MBB/0Uwvthso8+VAnJh9TGnYW/8mNlYRTPJvSbDUuknBiR t2UlOUEEBuNeRwTsvLB90HVPZGGLBXCg7oIndJEw2QNOcQ3HJ3TCyQJljHHALyFNq2CA J2p2YFE8hvg5rtSEPkHTasjIdYTGU4LtIoBg/Q09UKCBtMR1hcUD3AgyPtA2593FhUNZ wMHg== X-Gm-Message-State: AFeK/H0xSqbhTMKiHGs2gE05cnTTK74dXsGpBUfhPsf7Sd6KNdpyAaNfc+VQsSgJWWSU5Goow/bZa3clyUVtmw== X-Received: by 10.25.235.77 with SMTP id j74mr6319872lfh.60.1491271699591; Mon, 03 Apr 2017 19:08:19 -0700 (PDT) In-Reply-To: <20170404003657.22843-1-stefan.sedich@gmail.com> Xref: news.gmane.org gmane.linux.lib.musl.general:11207 Archived-At: --001a113c34d6eaf7a1054c4dbfba Content-Type: text/plain; charset=UTF-8 One thing I have found though is that the way the retry logic works if I want to retry ever 1 second for a total of 5 times I need to set it to 'options timeout:5 attempts:5', not sure if someone who knows this area well can comment but it appears to create a retry_interval based on timeout/attempts, which as far as I understand it is different to how it works with glibc where I can set timeout:1 attempts:5 and it does as I expect. - Stefan On Mon, Apr 3, 2017 at 5:37 PM Stefan Sedich wrote: > This fixes an issue were the attempts was not being recpected in > resolv.conf, from what I could see > it used to work this way but changed some time during the refactor to > resolvconf. > > --- > src/network/resolvconf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c > index 2cf1f475..4c3e4c4b 100644 > --- a/src/network/resolvconf.c > +++ b/src/network/resolvconf.c > @@ -45,8 +45,8 @@ int __get_resolv_conf(struct resolvconf *conf, char > *search, size_t search_sz) > if (z != p) conf->ndots = x > 15 ? 15 : x; > } > p = strstr(line, "attempts:"); > - if (p && isdigit(p[6])) { > - p += 6; > + if (p && isdigit(p[9])) { > + p += 9; > unsigned long x = strtoul(p, &z, 10); > if (z != p) conf->attempts = x > 10 ? 10 : > x; > } > -- > 2.11.0 > > --001a113c34d6eaf7a1054c4dbfba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
One thing I have found though is that the way the retry lo= gic works if I want to retry ever 1 second for a total of 5 times I need to= set it to 'options timeout:5 attempts:5', not sure if someone who = knows this area well can comment but it appears to create a retry_interval = based on timeout/attempts, which as far as I understand it is different to = how it works with glibc where I can set timeout:1 attempts:5 and it does as= I expect.



- Stefan
<= /div>
On Mon, Apr 3, 2017 at= 5:37 PM Stefan Sedich <stefa= n.sedich@gmail.com> wrote:
T= his fixes an issue were the attempts was not being recpected in resolv.conf= , from what I could see
it used to work this way but changed some time during the refactor to resol= vconf.

---
=C2=A0src/network/resolvconf.c | 4 ++--
=C2=A01 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c
index 2cf1f475..4c3e4c4b 100644
--- a/src/network/resolvconf.c
+++ b/src/network/resolvconf.c
@@ -45,8 +45,8 @@ int __get_resolv_conf(struct resolvconf *conf, char *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