mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH v2] attempts option not being respected in resolv.conf
@ 2017-04-04  0:36 Stefan Sedich
  2017-04-04  2:08 ` Stefan Sedich
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Sedich @ 2017-04-04  0:36 UTC (permalink / raw)
  To: musl; +Cc: Stefan Sedich

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] attempts option not being respected in resolv.conf
  2017-04-04  0:36 [PATCH v2] attempts option not being respected in resolv.conf Stefan Sedich
@ 2017-04-04  2:08 ` Stefan Sedich
  2017-04-17 20:41   ` Stefan Sedich
  2017-04-22 22:32   ` Rich Felker
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Sedich @ 2017-04-04  2:08 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

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 <stefan.sedich@gmail.com>
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
>
>

[-- Attachment #2: Type: text/html, Size: 2641 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] attempts option not being respected in resolv.conf
  2017-04-04  2:08 ` Stefan Sedich
@ 2017-04-17 20:41   ` Stefan Sedich
  2017-04-22 22:32   ` Rich Felker
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Sedich @ 2017-04-17 20:41 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]

Any thoughts from anybody on this? I want to tweak my attempts settings but
at the moment they are not read at all.



Thanks

On Mon, Apr 3, 2017 at 7:08 PM Stefan Sedich <stefan.sedich@gmail.com>
wrote:

> 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 <stefan.sedich@gmail.com>
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3476 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] attempts option not being respected in resolv.conf
  2017-04-04  2:08 ` Stefan Sedich
  2017-04-17 20:41   ` Stefan Sedich
@ 2017-04-22 22:32   ` Rich Felker
  2017-04-23  2:42     ` Stefan Sedich
  1 sibling, 1 reply; 5+ messages in thread
From: Rich Felker @ 2017-04-22 22:32 UTC (permalink / raw)
  To: musl

On Tue, Apr 04, 2017 at 02:08:08AM +0000, Stefan Sedich wrote:
> 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.

The man page documents timeout as "amount of time the resolver will
wait for a response from a remote name server before retrying the
query via a different name server". Since musl does not cycle through
servers, but tries them all concurrently, this definition does not
make sense, so we have to find a reasonable way to interpret the
options, but I agree it might be "wrong" right now. It might be that,
rather than retry_interval being timeout/attempts, retry_interval
should be timeout, and the total timeout should be timeout*attempts.
We really should look at the glibc behavior and see how it scales with
different settings and numbers of nameservers and try to make the
behavior somehow comparable.

BTW sorry I missed your V2.

Rich


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] attempts option not being respected in resolv.conf
  2017-04-22 22:32   ` Rich Felker
@ 2017-04-23  2:42     ` Stefan Sedich
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Sedich @ 2017-04-23  2:42 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Thanks Rich,

I will mull over this and play around with glibc a bit more to see if I can
come up with something that gives us that ideal middle ground, I do agree
with your initial idea though it sounds like it could behave a little bit
closer to glibc but I will dig more and see.



Stefan

On Sat, Apr 22, 2017 at 3:32 PM Rich Felker <dalias@libc.org> wrote:

> On Tue, Apr 04, 2017 at 02:08:08AM +0000, Stefan Sedich wrote:
> > 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.
>
> The man page documents timeout as "amount of time the resolver will
> wait for a response from a remote name server before retrying the
> query via a different name server". Since musl does not cycle through
> servers, but tries them all concurrently, this definition does not
> make sense, so we have to find a reasonable way to interpret the
> options, but I agree it might be "wrong" right now. It might be that,
> rather than retry_interval being timeout/attempts, retry_interval
> should be timeout, and the total timeout should be timeout*attempts.
> We really should look at the glibc behavior and see how it scales with
> different settings and numbers of nameservers and try to make the
> behavior somehow comparable.
>
> BTW sorry I missed your V2.
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 2102 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-23  2:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04  0:36 [PATCH v2] attempts option not being respected in resolv.conf Stefan Sedich
2017-04-04  2:08 ` Stefan Sedich
2017-04-17 20:41   ` Stefan Sedich
2017-04-22 22:32   ` Rich Felker
2017-04-23  2:42     ` Stefan Sedich

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).