All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Josef Bacik <jbacik@fb.com>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH 10/14] dns: poll card between each dns request
Date: Mon, 15 Feb 2016 09:45:18 +0300	[thread overview]
Message-ID: <CAA91j0UrcunWzLFEAE3XhQ_wYu+W3_W98u9OduyKtFj4eF3iLg@mail.gmail.com> (raw)
In-Reply-To: <1455139268-3241273-11-git-send-email-jbacik@fb.com>

On Thu, Feb 11, 2016 at 12:21 AM, Josef Bacik <jbacik@fb.com> wrote:
> If we have dns servers that we prefer to get AAAA records from we'll send a
> packet and immediately check data.naddresses to see if we got a response.  If we
> didn't we'll then send a request for an A record, and _then_ we'll poll the
> card.  So if the DNS server doesn't respond between us sending the packet and
> checking data.naddresses we'll send a request for the A record and then poll the
> card.  Instead we need to make sure we poll after we issue each request to make
> sure we give the server enough time to respond to our initial request.
>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
>  grub-core/net/dns.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c
> index 82a3307..86e609b 100644
> --- a/grub-core/net/dns.c
> +++ b/grub-core/net/dns.c
> @@ -587,12 +587,12 @@ grub_net_dns_lookup (const char *name,
>                    grub_errno = GRUB_ERR_NONE;
>                    err = err2;
>                  }
> +             grub_net_poll_cards (200, &data.stop);

One consideration is that it will increase timeouts in case of
non-responsive servers, as now they are processed sequentially.

But more importantly, this is still hit and miss - we rely on delivery
order which is non-deterministic. We really need to ask for all and
filter on receiving side. Two possible implementations are

1. Keep track of IPv4 and IPv6 answers separately; if non-preferred
answer is received, continue to wait for preferred one until timeout.

2. Queries for both A and AAAA in the same packet and filter out answers.

The 2 looks better. It avoids extra timeouts (at least if we assume
that all DNS servers are equally authoritative) because as soon as we
get any response we can stop polling.

This will also indirectly fix another reported issue as we now can
ignore any duplicate packet.

Would you consider implementing it?

>                if (*data.naddresses)
>                  goto out;
>              }
>            while (t == 1);
>         }
> -      grub_net_poll_cards (200, &data.stop);
>      }
>   out:
>    grub_free (data.name);
> --
> 1.8.1
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


  reply	other threads:[~2016-02-15  6:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 21:20 [PATCH 00/14] Facebook's netbooting patches Josef Bacik
2016-02-10 21:20 ` [PATCH 01/14] Added net_bootp6 command Josef Bacik
2016-02-10 21:20 ` [PATCH 02/14] UEFI IPv6 PXE support Josef Bacik
2016-02-10 21:20 ` [PATCH 03/14] Use UEFI MAC device as default configured by net_bootp6 Josef Bacik
2016-02-10 21:20 ` [PATCH 04/14] tcp: add window scaling and RTTM support Josef Bacik
2016-02-10 21:20 ` [PATCH 05/14] net: don't free uninitialized sockets in dns Josef Bacik
2016-02-13 17:59   ` Andrei Borzenkov
2016-02-16 16:13     ` Josef Bacik
2016-02-10 21:21 ` [PATCH 06/14] net: fix ipv6 routing Josef Bacik
2016-02-25 19:39   ` Andrei Borzenkov
2016-02-10 21:21 ` [PATCH 07/14] efinet: retransmit if our device is busy Josef Bacik
2016-02-10 21:21 ` [PATCH 08/14] efinet: filter multicast traffic based on addresses Josef Bacik
2016-02-10 21:21 ` [PATCH 09/14] efinet: clear the txbuffer before modifying the receive filters Josef Bacik
2016-02-10 21:21 ` [PATCH 10/14] dns: poll card between each dns request Josef Bacik
2016-02-15  6:45   ` Andrei Borzenkov [this message]
2016-02-16 16:16     ` Josef Bacik
2016-02-23 22:02     ` Josef Bacik
2016-02-24  3:25       ` Andrei Borzenkov
2016-02-10 21:21 ` [PATCH 11/14] dns: reset data->naddresses for every packet we receive Josef Bacik
2016-02-13 16:05   ` Andrei Borzenkov
2016-02-16 16:18     ` Josef Bacik
2016-02-10 21:21 ` [PATCH 12/14] icmp6: use default interface as the route interface Josef Bacik
2016-02-10 21:21 ` [PATCH 13/14] bootp: don't add multiple interfaces for the same address Josef Bacik
2016-02-10 21:21 ` [PATCH 14/14] net: add interfaces when we open a card Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA91j0UrcunWzLFEAE3XhQ_wYu+W3_W98u9OduyKtFj4eF3iLg@mail.gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.